Package org.assertj.core.presentation
Class HeadTailAccumulator<T>
- java.lang.Object
-
- org.assertj.core.presentation.HeadTailAccumulator<T>
-
final class HeadTailAccumulator<T> extends java.lang.ObjectAccumulates the values in a stream or iterable, keeping the first and last elements and discarding everything in between.
-
-
Constructor Summary
Constructors Constructor Description HeadTailAccumulator(int headCapacity, int tailCapacity)Creates a newHeadTailAccumulator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidadd(T element)Adds an element to the accumulator, possibly displacing an older element.(package private) java.util.stream.Stream<T>stream()Converts the accumulated elements into a stream.
-
-
-
Constructor Detail
-
HeadTailAccumulator
HeadTailAccumulator(int headCapacity, int tailCapacity)Creates a newHeadTailAccumulator.- Parameters:
headCapacity- the maximum number of elements to retain from the start of the streamtailCapacity- the maximum number of elements to retain from the end of the stream.- Throws:
java.lang.IllegalArgumentException- if either argument is negative
-
-