Package de.espirit.common.util
Interface Listable<T>
- Type Parameters:
T
- The type of store elements.
- All Superinterfaces:
Iterable<T>
An iterable on store elements that enables to transform the
iterable into a list.
- Since:
- 4.0
-
Method Summary
Modifier and TypeMethodDescriptiongetFirst()
Get the first element provided by this listable.default boolean
isEmpty()
Indicates that the listable has no entries.
Defaults to invokingtoList()
Creates a new, mutable list containing all elements.
Attention: Avoid using this method for iterative usage patterns.toStream()
Returns aStream
based on the iterator of thisListable
.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Method Details
-
getFirst
Get the first element provided by this listable.- Returns:
- The first element or null, if empty.
- Since:
- 4.0
-
toList
Creates a new, mutable list containing all elements.
Attention: Avoid using this method for iterative usage patterns. Use methods ofIterable
instead.- Returns:
- A new list on elements.
- Since:
- 4.0
-
isEmpty
default boolean isEmpty()Indicates that the listable has no entries.
Defaults to invokinggetFirst() == null)
- Returns:
- true, if the listable is empty, false otherwise.
- Since:
- 5.2.200805
-
toStream
Returns aStream
based on the iterator of thisListable
.- Returns:
- a stream over the store elements of this
Listable
- Since:
- 5.2.230705
-