Interface Selectable<C,E>

Type Parameters:
C - the criteria type
E - the element type
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface Selectable<C,E>
A notional list of elements from which immutable sublists may be selected according to some criteria.
Author:
Laird Nelson
  • Method Summary

    Modifier and Type
    Method
    Description
    default List<E>
    Returns an immutable List of all of this Selectable's elements.
    select(C criteria)
    Selects and returns an immutable List representing a sublist of this Selectable's elements, as mediated by the supplied criteria.
  • Method Details

    • select

      List<E> select(C criteria)
      Selects and returns an immutable List representing a sublist of this Selectable's elements, as mediated by the supplied criteria.

      Implementations of this method must be idempotent and must return a determinate value.

      Implementations of this method must not return null.

      Implementations of this method should not call list(), since that method is typically implemented in terms of this one, or undefined behavior may result.

      Parameters:
      criteria - the criteria to use; may be null
      Returns:
      an immutable sublist of this Selectable's elements; never null
      See Also:
    • list

      default List<E> list()
      Returns an immutable List of all of this Selectable's elements.

      Implementations of this method must be idempotent and must return a determinate value.

      Implementations of this method must not return null.

      The default implementation of this method calls the select(Object) method with null as the sole argument.

      Returns:
      an immutable List of all of this Selectable's elements; never null
      See Also: