Class SingleEntryItemCollection
- java.lang.Object
-
- org.openjdk.jmc.flightrecorder.rules.jdk.util.SingleEntryItemCollection
-
- All Implemented Interfaces:
java.lang.Iterable<IItemIterable>,IItemCollection
final class SingleEntryItemCollection extends java.lang.Object implements IItemCollection
Implementation helper class for handling a singularIItemas anIItemCollection.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classSingleEntryItemCollection.SingleEntryIItemIterableprivate static classSingleEntryItemCollection.SingleEntryIteratorOfIterable
-
Field Summary
Fields Modifier and Type Field Description private IItemitemprivate static IItemCollectionNULLCOLLECTIONprivate static IItemIterableNULLITERABLE
-
Constructor Summary
Constructors Constructor Description SingleEntryItemCollection(IItem item)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IItemCollectionapply(IItemFilter filter)Creates a new item collection with all items in this collection that pass through the filter.<V,C extends IItemConsumer<C>>
VgetAggregate(IAggregator<V,C> aggregator)Calculates an aggregated value for the items in this collection.booleanhasItems()java.util.Iterator<IItemIterable>iterator()
-
-
-
Field Detail
-
NULLCOLLECTION
private static final IItemCollection NULLCOLLECTION
-
NULLITERABLE
private static final IItemIterable NULLITERABLE
-
item
private final IItem item
-
-
Constructor Detail
-
SingleEntryItemCollection
SingleEntryItemCollection(IItem item)
-
-
Method Detail
-
iterator
public java.util.Iterator<IItemIterable> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<IItemIterable>
-
apply
public IItemCollection apply(IItemFilter filter)
Description copied from interface:IItemCollectionCreates a new item collection with all items in this collection that pass through the filter. The collection may be eagerly or lazily evaluated.- Specified by:
applyin interfaceIItemCollection- Parameters:
filter- the filter to use when selecting items for the new collection- Returns:
- a new collection of items
-
getAggregate
public <V,C extends IItemConsumer<C>> V getAggregate(IAggregator<V,C> aggregator)
Description copied from interface:IItemCollectionCalculates an aggregated value for the items in this collection.- Specified by:
getAggregatein interfaceIItemCollection- Type Parameters:
V- aggregate result value typeC- Item consumer type. SeeIAggregator.- Returns:
- the aggregated value
-
hasItems
public boolean hasItems()
- Specified by:
hasItemsin interfaceIItemCollection- Returns:
trueif the collections contains items,falseotherwise
-
-