public class SlidingWindowCollection<T> extends java.lang.Object implements java.lang.Iterable<TimeWindow<T>>
| Constructor and Description |
|---|
SlidingWindowCollection(java.util.List<T> source,
TimestampSelector<T> selector,
long windowDuration,
long every,
long startTime)
Instantiates a new SlidingWindowCollection
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(T item)
Adds an item to the underlying source collection in chronological order.
|
void |
forEach(java.util.function.Consumer<? super TimeWindow<T>> action) |
java.util.Iterator<TimeWindow<T>> |
iterator() |
java.util.Spliterator<TimeWindow<T>> |
spliterator() |
public SlidingWindowCollection(java.util.List<T> source, TimestampSelector<T> selector, long windowDuration, long every, long startTime)
source - the underlying source collectionselector - the interface used to select a timestamp from an itemwindowDuration - the duration of a time windowevery - the time between the starting point of each time windowstartTime - the first time an object can be in a time window -- items before the start time will be evicted from the source collection.public void add(T item)
item - the item to addpublic java.util.Iterator<TimeWindow<T>> iterator()
iterator in interface java.lang.Iterable<TimeWindow<T>>public void forEach(java.util.function.Consumer<? super TimeWindow<T>> action)
forEach in interface java.lang.Iterable<TimeWindow<T>>public java.util.Spliterator<TimeWindow<T>> spliterator()
spliterator in interface java.lang.Iterable<TimeWindow<T>>