dropLast()
Keep all elements except the last
count elements of the stream.Implementation Notes
Holds at most count number of elements in memory before emitting them as it becomes clear that they are not in
the trailing count elements in the stream. For a version that takes the last count elements, see takeLast().
Signature
dropLast(int count)
count- The positive number of elements to remove from the end of the input stream
Examples
Drop the last 2 elements from the input stream
Stream
.of("A", "B", "C", "D", "E")
.gather(Gatherers4j.dropLast(2))
.toList();
// ["A", "B", "C"]