Interface IIterableFirstElementSearcher
- All Known Subinterfaces:
IIterableSearcher
- All Known Implementing Classes:
IterableSearcher
public interface IIterableFirstElementSearcher
- Author:
- Silvan Wyss
-
Method Summary
Modifier and TypeMethodDescription<E> EgetStoredFirst(Iterable<E> iterable, Predicate<? super E> selector) The time complexity of this method is O(n) if the given iterable contains n elements.<E> EgetStoredFirstNonNull(Iterable<E> iterable) The time complexity of this method is O(n) if the given iterable contains n elements.<E, T extends E>
TgetStoredFirstOfType(Iterable<E> iterable, Class<T> type) The time complexity of this method is O(n) if the given iterable contains n elements.
-
Method Details
-
getStoredFirstNonNull
The time complexity of this method is O(n) if the given iterable contains n elements.- Type Parameters:
E- the type of the elements of the given iterable- Parameters:
iterable- the searched iterable, is considered to be empty when is null- Returns:
- the first non-null element of the given iterable
- Throws:
RuntimeException- if the given iterable does not contain a non-null element
-
getStoredFirst
The time complexity of this method is O(n) if the given iterable contains n elements.- Type Parameters:
E- the type of the elements of the given iterable- Parameters:
iterable- the searched iterable, is considered to be empty when is nullselector- can select elements, is considered not to select any element when is null- Returns:
- the first element the given selector selects of the given
Iterable, ignoring null elements - Throws:
RuntimeException- if the given iterable does not contain an element the given selector selects
-
getStoredFirstOfType
The time complexity of this method is O(n) if the given iterable contains n elements.- Type Parameters:
E- the type of the elements of the given iterableT- the modeled type of the given type- Parameters:
iterable- the searched iterable, is considered to be empty when is nulltype-- Returns:
- the first element of the given iterable that is of the given type
- Throws:
RuntimeException- if the given type is nullRuntimeException- if the given iterable does not contain an element of the given type.
-