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>

public interface Assortment<T> extends Countable, Enumerable<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 Details

    • contains

      boolean contains(T candidate)
      Tests if the given values is contained in this assortment. Comparison using Object.equals(Object) is performed.
      Parameters:
      candidate - the candidate value to test
      Returns:
      true if the value is contained, false otherwise
    • containsAll

      default boolean containsAll(Iterable<? extends T> all)
      Tests if all the given values are contained in this assortment. Comparison using Object.equals(Object) is performed.
      Parameters:
      all - the candidate values to test
      Returns:
      true if all the values are contained, false otherwise
    • 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 the Assortment This overrides Enumerable.count() and an exception will never occur, since Assortments always have a finite number of elements.
      Specified by:
      count in interface Countable
      Specified by:
      count in interface Enumerable<T>
      Returns:
      the number of elements in the Assortment
    • isEmpty

      boolean isEmpty()
      Checks whether the Assortment has no elements
      Specified by:
      isEmpty in interface Countable
      Specified by:
      isEmpty in interface Enumerable<T>
      Returns:
      true if it has no elements, false otherwise