Interface CIterableState<E>
-
- All Superinterfaces:
CBaseState<java.lang.Iterable<E>>
,CObjectState<java.lang.Iterable<E>>
,java.io.Serializable
- All Known Subinterfaces:
CCollection<E>
,CCollectionState<E>
,CDynamicCollectionExtension<E>
,CDynamicIterableExtension<E>
,CIterable<E>
,CStaticCollectionExtension<E>
,CStaticIterableExtension<E>
- All Known Implementing Classes:
CConfigInfoCollection
,CList
,CSet
public interface CIterableState<E> extends CObjectState<java.lang.Iterable<E>>
CIterableState is an interface for Iterable state related methods.
We need this interface to have possibility of adding state to any exists objects with the minimum change in the code.
-
-
Field Summary
-
Fields inherited from interface org.catools.common.extensions.states.interfaces.CBaseState
serialVersionUID
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default boolean
contains(java.lang.Object o)
Returnstrue
if this collection contains the specified element.default boolean
containsAll(java.lang.Iterable<E> expected, java.util.function.Consumer<E> onNotMatch)
Check if actual collection contains all elements from the expected collection.default boolean
containsAny(java.lang.Iterable<E> expected)
Check if actual collection contains any element from the expected collection.default boolean
containsNone(java.lang.Iterable<E> expected)
Check if actual collection contains none of elements from the expected collection.default boolean
containsNone(java.lang.Iterable<E> expected, java.util.function.Consumer<E> onMatch)
Check if actual collection contains none of elements from the expected collection.default boolean
emptyOrContains(E expected)
Check if actual collection either is empty or contains the expected element.default boolean
emptyOrNotContains(E expected)
Check if actual collection either is empty or does not contain the expected element.default boolean
has(java.util.function.Predicate<E> expected)
Check if iterable contains any value.default boolean
hasNot(java.util.function.Predicate<E> expected)
Check if iterable contains any value.default boolean
isEmpty()
Check if iterable is empty.default boolean
isEqual(java.lang.Iterable<E> expected)
Check if actual and expected collections have the exact same elements.default boolean
isEqual(java.lang.Iterable<E> expected, java.util.function.Consumer<E> onActualNotContains, java.util.function.Consumer<E> onExpectedNotContains)
Check if actual and expected collections have the exact same elements.default boolean
isNotEmpty()
Check if iterable contains any value.default boolean
notContains(E expected)
Check if actual collection does not contain the expected element.default boolean
notContainsAll(java.lang.Iterable<E> expected)
Check if actual collection does not contain all elements from the expected collection.default boolean
notContainsAll(java.lang.Iterable<E> expected, java.util.function.Consumer<E> onActualContains)
Check if actual collection does not contain all elements from the expected collection.-
Methods inherited from interface org.catools.common.extensions.states.interfaces.CBaseState
getBaseValue
-
Methods inherited from interface org.catools.common.extensions.states.interfaces.CObjectState
equalsAny, equalsAny, equalsNone, equalsNone, isNotNull, isNull, notEquals, test
-
-
-
-
Method Detail
-
has
default boolean has(java.util.function.Predicate<E> expected)
Check if iterable contains any value.- Returns:
- execution boolean result
-
hasNot
default boolean hasNot(java.util.function.Predicate<E> expected)
Check if iterable contains any value.- Returns:
- execution boolean result
-
isNotEmpty
default boolean isNotEmpty()
Check if iterable contains any value.- Returns:
- execution boolean result
-
isEmpty
default boolean isEmpty()
Check if iterable is empty.- Returns:
- execution boolean result
-
contains
default boolean contains(java.lang.Object o)
Returnstrue
if this collection contains the specified element. More formally, returnstrue
if and only if this collection contains at least one elemente
such thatObjects.equals(o, e)
.- Parameters:
o
- element whose presence in this collection is to be tested- Returns:
true
if this collection contains the specified element- Throws:
java.lang.ClassCastException
- if the type of the specified element is incompatible with this collectionjava.lang.NullPointerException
- if the specified element is null and this collection does not permit null elements
-
containsAny
default boolean containsAny(java.lang.Iterable<E> expected)
Check if actual collection contains any element from the expected collection.- Parameters:
expected
- value to compare- Returns:
- execution boolean result
-
containsAll
default boolean containsAll(java.lang.Iterable<E> expected, java.util.function.Consumer<E> onNotMatch)
Check if actual collection contains all elements from the expected collection. Please note that actual collection might have more elements.- Parameters:
expected
- value to compareonNotMatch
- consumer to call if no match found- Returns:
- execution boolean result
-
containsNone
default boolean containsNone(java.lang.Iterable<E> expected)
Check if actual collection contains none of elements from the expected collection.- Parameters:
expected
- value to compare- Returns:
- execution boolean result
-
containsNone
default boolean containsNone(java.lang.Iterable<E> expected, java.util.function.Consumer<E> onMatch)
Check if actual collection contains none of elements from the expected collection.- Parameters:
expected
- value to compareonMatch
- consumer to call if match found- Returns:
- execution boolean result
-
emptyOrContains
default boolean emptyOrContains(E expected)
Check if actual collection either is empty or contains the expected element.- Parameters:
expected
- value to compare- Returns:
- execution boolean result
-
emptyOrNotContains
default boolean emptyOrNotContains(E expected)
Check if actual collection either is empty or does not contain the expected element.- Parameters:
expected
- value to compare- Returns:
- execution boolean result
-
isEqual
default boolean isEqual(java.lang.Iterable<E> expected)
Check if actual and expected collections have the exact same elements. (Ignore element order) First we compare that actual collection contains all expected collection elements and then we verify that expected has all elements from actual.- Specified by:
isEqual
in interfaceCObjectState<E>
- Parameters:
expected
- value to compare- Returns:
- execution boolean result
-
isEqual
default boolean isEqual(java.lang.Iterable<E> expected, java.util.function.Consumer<E> onActualNotContains, java.util.function.Consumer<E> onExpectedNotContains)
Check if actual and expected collections have the exact same elements. (Ignore element order) First we compare that actual collection contains all expected collection elements and then we verify that expected has all elements from actual.- Parameters:
expected
- value to compareonActualNotContains
- consumer to call if match foundonExpectedNotContains
- consumer to call if match found- Returns:
- execution boolean result
-
notContains
default boolean notContains(E expected)
Check if actual collection does not contain the expected element.- Parameters:
expected
- value to compare- Returns:
- execution boolean result
-
notContainsAll
default boolean notContainsAll(java.lang.Iterable<E> expected)
Check if actual collection does not contain all elements from the expected collection. Please note that actual collection might have some of elements but the point is to ensure that not all expected elements are exist in it.- Parameters:
expected
- value to compare- Returns:
- execution boolean result
-
notContainsAll
default boolean notContainsAll(java.lang.Iterable<E> expected, java.util.function.Consumer<E> onActualContains)
Check if actual collection does not contain all elements from the expected collection. Please note that actual collection might have some of elements but the point is to ensure that not all expected elements are exist in it.- Parameters:
onActualContains
- consumer to call if match foundexpected
- value to compare- Returns:
- execution boolean result
-
-