public class SessionWindowCollection<T> extends java.lang.Object implements java.lang.Iterable<TimeWindow<T>>
Constructor and Description |
---|
SessionWindowCollection(java.util.List<T> source,
TimestampSelector<T> selector,
long startTime,
long timeout)
Instantiates a new SessionWindowCollection
|
Modifier and Type | Method and Description |
---|---|
void |
add(T item)
Adds an item to the source collection in time ordered fashion.
|
void |
forEach(java.util.function.Consumer<? super TimeWindow<T>> action) |
java.util.Iterator<TimeWindow<T>> |
iterator() |
java.util.Spliterator<TimeWindow<T>> |
spliterator() |
public SessionWindowCollection(java.util.List<T> source, TimestampSelector<T> selector, long startTime, long timeout)
source
- the underlying source.selector
- the selector used to pull a timestamp from an item in the source collection and subsequent insertionsstartTime
- the first time an object can be in a time window -- items before the start time will be evicted from the source collection.timeout
- the minimum amount of time between session window rangespublic 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>>