Interface Listable<T>

Type Parameters:
T - The type of store elements.
All Superinterfaces:
Iterable<T>

public interface Listable<T> extends Iterable<T>
An iterable on store elements that enables to transform the iterable into a list.
Since:
4.0
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the first element provided by this listable.
    default boolean
    Indicates that the listable has no entries.
    Defaults to invoking
    @NotNull List<T>
    Creates a new, mutable list containing all elements.
    Attention: Avoid using this method for iterative usage patterns.
    default Stream<T>
    Returns a Stream based on the iterator of this Listable.

    Methods inherited from interface java.lang.Iterable

    forEach, iterator, spliterator
  • Method Details

    • getFirst

      @Nullable T getFirst()
      Get the first element provided by this listable.
      Returns:
      The first element or null, if empty.
      Since:
      4.0
    • toList

      @NotNull @NotNull List<T> toList()
      Creates a new, mutable list containing all elements.
      Attention: Avoid using this method for iterative usage patterns. Use methods of Iterable instead.
      Returns:
      A new list on elements.
      Since:
      4.0
    • isEmpty

      default boolean isEmpty()
      Indicates that the listable has no entries.
      Defaults to invoking
      getFirst() == null)
      Returns:
      true, if the listable is empty, false otherwise.
      Since:
      5.2.200805
    • toStream

      default Stream<T> toStream()
      Returns a Stream based on the iterator of this Listable.
      Returns:
      a stream over the store elements of this Listable
      Since:
      5.2.230705