Class IterableExaminer
java.lang.Object
ch.nolix.base.commontype.iterableexaminer.IterableExaminer
- All Implemented Interfaces:
IIterableContainAnyExaminer, IIterableContainEqualExaminer, IIterableContainMatchingExaminer, IIterableContainMultipleExaminer, IIterableContainObjectExaminer, IIterableExaminer
- Author:
- Silvan Wyss
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleancontainsAll(Iterable<?> iterable, Iterable<?> objects) booleancontainsAll(Iterable<? extends Object> iterable, Object... objects) booleancontainsAny(Iterable<?> iterable) The time complexity of this method is O(1).booleancontainsAny(Iterable<?> iterable, Iterable<?> objects) booleancontainsAny(Iterable<?> iterable, Object... objects) booleancontainsEqual(Iterable<?> iterable, Object object) The time complexity of this method is O(n) if the currentIIterableContainEqualExaminercontains n elements.booleancontainsExactlyAll(Iterable<?> iterable, Iterable<?> objects) booleancontainsExactlyAll(Iterable<?> iterable, Object... objects) booleancontainsExactlyAllEqualInSameOrder(Iterable<?> iterable, Iterable<?> objects) booleancontainsExactlyAllInSameOrder(Iterable<?> iterable, Iterable<?> objects) booleancontainsExactlyAllInSameOrder(Iterable<?> iterable, Object... objects) <T> booleancontainsMatching(Iterable<T> iterable, Predicate<T> selector) <T> booleancontainsMatchingOnly(Iterable<T> iterable, Predicate<T> selector) booleancontainsNoEqual(Iterable<?> iterable, Object object) The time complexity of this method is O(n) if the currentIIterableContainEqualExaminercontains n elements.<T> booleancontainsNoMatching(Iterable<T> iterable, Predicate<T> selector) booleancontainsNone(Iterable<?> iterable, Iterable<?> objects) booleancontainsNone(Iterable<?> iterable, Object... objects) booleancontainsNonNull(Iterable<?> iterable) The time complexity of this method is O(n) if the given iterable contains n elements.booleancontainsOnce(Iterable<?> iterable, Object object) booleancontainsOne(Iterable<?> iterable) The time complexity of this method is O(1).booleancontainsOneEqual(Iterable<?> iterable, Object object) The time complexity of this method is O(n) if the currentIIterableContainEqualExaminercontains n elements.<T> booleancontainsOneMatching(Iterable<T> iterable, Predicate<T> selector) booleancontainsOneNoneNull(Iterable<?> iterable) The time complexity of this method is O(n) if the given iterable contains n elements.booleancontainsOnly(Iterable<?> iterable, Object object) booleanThe time complexity of this method is O(1).
-
Constructor Details
-
IterableExaminer
public IterableExaminer()
-
-
Method Details
-
contains
- Specified by:
containsin interfaceIIterableContainObjectExaminer- Parameters:
iterable- the searchedIterable, is considered to be empty when is nullobject-- Returns:
- true if the given iterable contains the given object, false otherwise
-
containsAll
- Specified by:
containsAllin interfaceIIterableContainMultipleExaminer- Parameters:
iterable- the searchedIterable, is considered to be empty when is nullobjects- the searched objects, is considered to be empty when is null- Returns:
- true if the given iterable contains all of the given objects, false otherwise
-
containsAll
- Specified by:
containsAllin interfaceIIterableContainMultipleExaminer- Parameters:
iterable- the searchedIterable, is considered to be empty when is nullobjects- the searched objects, is considered to be empty when is null- Returns:
- true if the given iterable contains all of the given objects, false otherwise
-
containsAny
The time complexity of this method is O(1).- Specified by:
containsAnyin interfaceIIterableContainAnyExaminer- Parameters:
iterable- the searchedIterable, is considered to be empty when is null- Returns:
- true if the given iterable contains an element, false otherwise
-
containsAny
- Specified by:
containsAnyin interfaceIIterableContainMultipleExaminer- Parameters:
iterable- the searchedIterable, is considered to be empty when is nullobjects- the searched objects, is considered to be empty when is null- Returns:
- true if the given iterable contains any of the given objects, false otherwise
-
containsAny
- Specified by:
containsAnyin interfaceIIterableContainMultipleExaminer- Parameters:
iterable- the searchedIterable, is considered to be empty when is nullobjects- the searched objects, is considered to be empty when is null- Returns:
- true if the given iterable contains any of the given objects, false otherwise
-
containsEqual
The time complexity of this method is O(n) if the currentIIterableContainEqualExaminercontains n elements.- Specified by:
containsEqualin interfaceIIterableContainEqualExaminer- Parameters:
iterable- the searchedIterable, is considered to be empty when is nullobject- the object of which an equal element will be searched for- Returns:
- true if the given iterable contains an element that equals the given object, false otherwise
-
containsExactlyAll
- Specified by:
containsExactlyAllin interfaceIIterableContainMultipleExaminer- Parameters:
iterable- the searchedIterable, is considered to be empty when is nullobjects- the searched objects, is considered to be empty when is null- Returns:
- true if the given iterable contains exactly all the given objects, false otherwise
-
containsExactlyAll
- Specified by:
containsExactlyAllin interfaceIIterableContainMultipleExaminer- Parameters:
iterable- the searchedIterable, is considered to be empty when is nullobjects- the searched objects, is considered to be empty when is null- Returns:
- true if the given iterable contains exactly all the given objects, false otherwise
-
containsExactlyAllEqualInSameOrder
- Specified by:
containsExactlyAllEqualInSameOrderin interfaceIIterableContainMultipleExaminer- Parameters:
iterable- the searchedIterable, is considered to be empty when is nullobjects- the searched for objects, is considered to be empty when is null- Returns:
- true if the given iterable contains exactly such elements that equal the given objects in the same order, false otherwise
-
containsExactlyAllInSameOrder
- Specified by:
containsExactlyAllInSameOrderin interfaceIIterableContainMultipleExaminer- Parameters:
iterable- the searchedIterable, is considered to be empty when is nullobjects- the searched for objects, is considered to be empty when is null- Returns:
- true if the given iterable contains exactly all the given objects in the same order, false otherwise
-
containsExactlyAllInSameOrder
- Specified by:
containsExactlyAllInSameOrderin interfaceIIterableContainMultipleExaminer- Parameters:
iterable- the searchedIterable, is considered to be empty when is nullobjects- the searched objects, is considered to be empty when is null- Returns:
- true if the given iterable contains exactly all the given objects in the same order, false otherwise
-
containsMatching
- Specified by:
containsMatchingin interfaceIIterableContainMatchingExaminer- Type Parameters:
T- the type of the elements of the given iterable- Parameters:
iterable- the searchedIterable, is considered to be empty when is nullselector- can select elements, is considered not to select any element when is null- Returns:
- true if the given iterable contains an element the given selector selects, false otherwise, ignoring null elements in the given iterable
-
containsMatchingOnly
- Specified by:
containsMatchingOnlyin interfaceIIterableContainMatchingExaminer- Type Parameters:
T- the type of the elements of the given iterable- Parameters:
iterable- the searchedIterable, is considered to be empty when is nullselector- can select elements, is considered not to select any element when is null- Returns:
- true if the given iterable contains only elements the given selector selects, but at least 1 time, false otherwise, ignoring null elements in the given iterable.
-
containsNoEqual
The time complexity of this method is O(n) if the currentIIterableContainEqualExaminercontains n elements.- Specified by:
containsNoEqualin interfaceIIterableContainEqualExaminer- Parameters:
iterable- the searchedIterable, is considered to be empty when is nullobject- the object of which equal elements will be searched for- Returns:
- true if the given iterable does not contain an element that equals the given object, false otherwise
-
containsNoMatching
- Specified by:
containsNoMatchingin interfaceIIterableContainMatchingExaminer- Type Parameters:
T- the type of the elements of the given iterable- Parameters:
iterable- the searchedIterable, is considered to be empty when is nullselector- can select elements, is considered not to select any element when is null- Returns:
- true if the given iterable does not contain an element the given selector selects, false otherwise, ignoring null elements in the given iterable.
-
containsNone
- Specified by:
containsNonein interfaceIIterableContainMultipleExaminer- Parameters:
iterable- the searchedIterable, is considered to be empty when is nullobjects- the searched objects, is considered to be empty when is null- Returns:
- true if the given iterable does not contain any of the given objects, false otherwise
-
containsNone
- Specified by:
containsNonein interfaceIIterableContainMultipleExaminer- Parameters:
iterable- the searchedIterable, is considered to be empty when is nullobjects- the searched objects, is considered to be empty when is null- Returns:
- true if the given iterable does not contain any of the given objects, false otherwise
-
containsNonNull
The time complexity of this method is O(n) if the given iterable contains n elements.- Specified by:
containsNonNullin interfaceIIterableContainAnyExaminer- Parameters:
iterable- the searchedIterable, is considered to be empty when is null- Returns:
- true if the given iterable contains a non-null element, false otherwise
-
containsOnce
- Specified by:
containsOncein interfaceIIterableContainObjectExaminer- Parameters:
iterable- the searchedIterable, is considered to be empty when is nullobject-- Returns:
- true if the given iterable contains the given object exactly 1 time, false otherwise
-
containsOne
The time complexity of this method is O(1).- Specified by:
containsOnein interfaceIIterableContainAnyExaminer- Parameters:
iterable- the searchedIterable, is considered to be empty when is null- Returns:
- true if the given iterable contains exactly 1 element, false otherwise
-
containsOneEqual
The time complexity of this method is O(n) if the currentIIterableContainEqualExaminercontains n elements.- Specified by:
containsOneEqualin interfaceIIterableContainEqualExaminer- Parameters:
iterable- the searchedIterable, is considered to be empty when is nullobject- the object of which exactly 1 equal element will be searched for- Returns:
- true if the given iterable contains exactly 1 element that equals the given object, false otherwise
-
containsOneMatching
- Specified by:
containsOneMatchingin interfaceIIterableContainMatchingExaminer- Type Parameters:
T- the type of the elements of the given iterable- Parameters:
iterable- the searchedIterable, is considered to be empty when is nullselector- can select elements, is considered not to select any element when is null- Returns:
- true if the given iterable contains exactly 1 element the given selector selects, false otherwise, ignoring null elements in the given iterable.
-
containsOneNoneNull
The time complexity of this method is O(n) if the given iterable contains n elements.- Specified by:
containsOneNoneNullin interfaceIIterableContainAnyExaminer- Parameters:
iterable- the searchedIterable, is considered to be empty when is null- Returns:
- true if the given iterable contains exactly 1 non-null element, false otherwise
-
containsOnly
- Specified by:
containsOnlyin interfaceIIterableContainObjectExaminer- Parameters:
iterable- the searchedIterable, is considered to be empty when is nullobject-- Returns:
- true if the given iterable contains only the given object, but at least 1 time, false otherwise
-
isEmpty
The time complexity of this method is O(1).- Specified by:
isEmptyin interfaceIIterableContainAnyExaminer- Parameters:
iterable- the searchedIterable, is considered to be empty when is null- Returns:
- true if the given iterable is empty, false otherwise
-