Package org.midheaven.collections
Interface Assortment<T>
- Type Parameters:
T- type of element in the Assortment
- All Superinterfaces:
Countable,Enumerable<T>,Iterable<T>
- All Known Subinterfaces:
Array<T>,Association<K,,V> DistinctAssortment<T>,EditableAssociation<K,,V> EditableSequence<T>,ResizableAssociation<K,,V> ResizableDistinctAssortment<T>,ResizableSequence<T>,Sequence<T>
Represent a finite aggregation of elements of a single type.
An assortment has no specific properties other than aggregating the elements.
There is no operations to obtain the element individually.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanTests if the given values is contained in this assortment.default booleancontainsAll(Iterable<? extends T> all) Tests if all the given values are contained in this assortment.count()The number of elements in theAssortmentThis overridesEnumerable.count()and an exception will never occur, sinceAssortments always have a finite number of elements.booleanisEmpty()Checks whether theAssortmenthas no elementsReturns an immutable Collection with the items in this Assortment for compatibility with JDK collections.Methods inherited from interface org.midheaven.collections.Enumerable
allMatch, any, anyMatch, as, associate, associate, cast, collect, concat, distinct, enumerator, filter, first, flatMap, groupBy, iterator, limit, map, maximum, minimum, ofType, peek, reduce, reduce, skip, sorted, toArray, toArray, toArray, toDistinctAssortment, toSequence, toSequence, with, zipMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
contains
Tests if the given values is contained in this assortment. Comparison usingObject.equals(Object)is performed.- Parameters:
candidate- the candidate value to test- Returns:
trueif the value is contained,falseotherwise
-
containsAll
Tests if all the given values are contained in this assortment. Comparison usingObject.equals(Object)is performed.- Parameters:
all- the candidate values to test- Returns:
trueif all the values are contained,falseotherwise
-
toCollection
Collection<T> toCollection()Returns an immutable Collection with the items in this Assortment for compatibility with JDK collections. Further alteration to the assortment do not affect the returned collection -
count
Int count()The number of elements in theAssortmentThis overridesEnumerable.count()and an exception will never occur, sinceAssortments always have a finite number of elements.- Specified by:
countin interfaceCountable- Specified by:
countin interfaceEnumerable<T>- Returns:
- the number of elements in the
Assortment
-
isEmpty
boolean isEmpty()Checks whether theAssortmenthas no elements- Specified by:
isEmptyin interfaceCountable- Specified by:
isEmptyin interfaceEnumerable<T>- Returns:
trueif it has no elements,falseotherwise
-