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 singularIItem
as anIItemCollection
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
SingleEntryItemCollection.SingleEntryIItemIterable
private static class
SingleEntryItemCollection.SingleEntryIteratorOfIterable
-
Field Summary
Fields Modifier and Type Field Description private IItem
item
private static IItemCollection
NULLCOLLECTION
private static IItemIterable
NULLITERABLE
-
Constructor Summary
Constructors Constructor Description SingleEntryItemCollection(IItem item)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IItemCollection
apply(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.boolean
hasItems()
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:
iterator
in interfacejava.lang.Iterable<IItemIterable>
-
apply
public IItemCollection apply(IItemFilter filter)
Description copied from interface:IItemCollection
Creates 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:
apply
in 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:IItemCollection
Calculates an aggregated value for the items in this collection.- Specified by:
getAggregate
in interfaceIItemCollection
- Type Parameters:
V
- aggregate result value typeC
- Item consumer type. SeeIAggregator
.- Returns:
- the aggregated value
-
hasItems
public boolean hasItems()
- Specified by:
hasItems
in interfaceIItemCollection
- Returns:
true
if the collections contains items,false
otherwise
-
-