Interface CCollection<E>
-
- All Superinterfaces:
CBaseState<java.util.Collection<E>>
,CBaseVerifier<java.util.Collection<E>>
,CBaseWaiter<java.util.Collection<E>>
,CCollectionExtension<E>
,CCollectionState<E>
,CCollectionVerifier<E>
,CCollectionWaiter<E>
,CObjectState<java.util.Collection<E>>
,CObjectVerifier<java.util.Collection<E>>
,CObjectWaiter<java.util.Collection<E>>
,java.util.Collection<E>
,java.lang.Iterable<E>
- All Known Implementing Classes:
CConfigInfoCollection
,CHolidayCollection
,CList
,CSet
,CTestResults
public interface CCollection<E> extends java.util.Collection<E>, CCollectionExtension<E>
This interfaceCCollection
uses to extendCollection
interface to facilitate testing and reduce coding. We hope to extend this class with more useful methods.- See Also:
Map
,CHashMap
,CLinkedMap
,CSet
,CList
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
add(E e)
Ensures that this collection contains the specified element (optional operation).boolean
addAll(java.util.Collection<? extends E> c)
Adds all of the elements in the specified collection to this collection (optional operation).default boolean
addIf(java.util.function.Predicate<E> predicate, E e)
Adde
to the list if thepredicate
condition returns true.void
clear()
Removes all of the elements from this collection (optional operation).boolean
contains(java.lang.Object o)
Returnstrue
if this collection contains the specified element.boolean
containsAll(java.util.Collection<?> c)
Returnstrue
if this collection contains all of the elements in the specified collection.boolean
equals(java.lang.Object c)
Returnstrue
if this collection equals the specified collection.void
forEach(java.util.function.Consumer<? super E> action)
Performs the given action for each element of theIterable
until all elements have been processed or the action throws an exception.default CList<E>
getAll(java.util.function.Predicate<E> predicate)
Returns CCliItemCollection sequance of values which matched thepredicate
.default E
getAny()
get a random value from the collection.default E
getAnyAndRemove()
get a random value from the collection and remove it from the list.default E
getFirst()
Returns a first element from list.default E
getFirst(java.util.function.Predicate<E> predicate)
Returns a first element from list which matched thepredicate
otherwise throwsNoSuchElementException
.default E
getFirstOrElse(E other)
Returns a first element from list if the list is not empty otherwise returnsother
value.default E
getFirstOrElse(java.util.function.Predicate<E> predicate, E other)
Returns a first element from list which matched thepredicate
otherwise returnsother
value.default E
getFirstOrNull()
Returns a first element from list if the list is not empty otherwise returnsnull
value.default E
getFirstOrNull(java.util.function.Predicate<E> predicate)
Returns CCliItemCollection first element from list which matched thepredicate
otherwise returnsnull
value.default E
getFirstOrThrow(java.lang.RuntimeException e)
Returns CCliItemCollection first element from list if the list is not empty otherwise throwsRuntimeException
.default E
getFirstOrThrow(java.util.function.Predicate<E> predicate, java.lang.RuntimeException e)
Returns CCliItemCollection first element from list which matched thepredicate
otherwise throwsRuntimeException
.CCollection<E>
getValue()
get theCollection
of itemsdefault boolean
has(java.util.function.Predicate<E> predicate)
Indicate ifpredicate
condition returns true for any record in the list The preferred alternative to this method isgetFirst()
,getFirstOrElse(Object)
,getFirstOrElse(Predicate, Object)
,getFirstOrThrow(RuntimeException)
,getFirstOrThrow(Predicate, RuntimeException)
hasNot(Predicate)
default boolean
hasNot(java.util.function.Predicate<E> predicate)
Indicate ifpredicate
condition returns false for all records in the list The preferred alternative to this method isgetFirst()
,getFirstOrElse(Object)
,getFirstOrElse(Predicate, Object)
,getFirstOrThrow(RuntimeException)
,getFirstOrThrow(Predicate, RuntimeException)
has(Predicate)
boolean
isEmpty()
Returnstrue
if this collection contains no elements.default boolean
isNotEmpty()
Returnstrue
if this collection contains any element.java.util.Iterator<E>
iterator()
Returns an iterator over the elements in this collection.default java.lang.String
join()
Joins the elements ofCCollection
into CCliItemCollection single String containing the provided elements.default java.lang.String
join(java.lang.String separator)
Joins the elements ofCCollection
into CCliItemCollection single String containing the provided elements.default java.lang.String
join(java.util.function.Function<? super E,? extends java.lang.String> mapper, java.lang.String separator)
Joins the elements ofCCollection
into CCliItemCollection single String containing the provided elements.default <R> java.util.stream.Stream<R>
map(java.util.function.Function<? super E,? extends R> mapper)
Returns CCliItemCollection stream consisting of the results of applying the given function to the elements of this stream.default <R> CList<R>
mapToList(java.util.function.Function<? super E,? extends R> mapper)
Returns CCliItemCollectionCList
consisting of the results of applying the given function to the elements of theCCollection
.default <R> CSet<R>
mapToSet(java.util.function.Function<? super E,? extends R> mapper)
Returns CCliItemCollectionCSet
consisting of the results of applying the given function to the elements of theCCollection
.default CList<CList<E>>
partition(int size)
Returns consecutive sublists of a list, each of the same size (the final list may be smaller).boolean
remove(java.lang.Object o)
Removes CCliItemCollection single instance of the specified element from this collection, if it is present (optional operation).boolean
removeAll(java.util.Collection<?> c)
Removes all of this collection's elements that are also contained in the specified collection (optional operation).boolean
removeIf(java.util.function.Predicate<? super E> filter)
Removes all of the elements of this collection that satisfy the given predicate.boolean
retainAll(java.util.Collection<?> c)
Retains only the elements in this collection that are contained in the specified collection (optional operation).int
size()
Returns the number of elements in this collection.java.util.Spliterator<E>
spliterator()
Creates CCliItemCollectionSpliterator
over the elements in this collection.java.util.stream.Stream<E>
stream()
Returns CCliItemCollection sequentialStream
with this collection as its source.java.lang.Object[]
toArray()
Returns an array containing all of the elements in this collection.<E1> E1[]
toArray(E1[] a)
Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array.default CList<E>
toList()
ConvertCCollection
toCList
and return the resultdefault CSet<E>
toSet()
ConvertCCollection
toCSet
and return the result-
Methods inherited from interface org.catools.common.extensions.verify.interfaces.CBaseVerifier
_verify, _verify, _verify
-
Methods inherited from interface org.catools.common.extensions.wait.interfaces.CBaseWaiter
getDefaultWaitInSeconds, getDefaultWaitIntervalInMilliSeconds
-
Methods inherited from interface org.catools.common.extensions.states.interfaces.CCollectionState
containsAll, containsNone, containsNone, emptyOrContains, emptyOrNotContains, equals, equals, notContains, notContainsAll, notContainsAll, sizeEquals, sizeIsGreaterThan, sizeIsLessThan
-
Methods inherited from interface org.catools.common.extensions.verify.interfaces.CCollectionVerifier
verifyContains, verifyContains, verifyContains, verifyContains, verifyContains, verifyContains, verifyContainsAll, verifyContainsAll, verifyContainsAll, verifyContainsAll, verifyContainsAll, verifyContainsAll, verifyContainsNone, verifyContainsNone, verifyContainsNone, verifyContainsNone, verifyContainsNone, verifyContainsNone, verifyEmptyOrContains, verifyEmptyOrContains, verifyEmptyOrContains, verifyEmptyOrContains, verifyEmptyOrContains, verifyEmptyOrContains, verifyEmptyOrNotContains, verifyEmptyOrNotContains, verifyEmptyOrNotContains, verifyEmptyOrNotContains, verifyEmptyOrNotContains, verifyEmptyOrNotContains, verifyEquals, verifyEquals, verifyEquals, verifyEquals, verifyEquals, verifyEquals, verifyIsEmpty, verifyIsEmpty, verifyIsEmpty, verifyIsEmpty, verifyIsEmpty, verifyIsEmpty, verifyIsNotEmpty, verifyIsNotEmpty, verifyIsNotEmpty, verifyIsNotEmpty, verifyIsNotEmpty, verifyIsNotEmpty, verifyNotContains, verifyNotContains, verifyNotContains, verifyNotContains, verifyNotContains, verifyNotContains, verifyNotContainsAll, verifyNotContainsAll, verifyNotContainsAll, verifyNotContainsAll, verifyNotContainsAll, verifyNotContainsAll, verifySizeEquals, verifySizeEquals, verifySizeEquals, verifySizeEquals, verifySizeEquals, verifySizeEquals, verifySizeIsGreaterThan, verifySizeIsGreaterThan, verifySizeIsGreaterThan, verifySizeIsGreaterThan, verifySizeIsGreaterThan, verifySizeIsGreaterThan, verifySizeIsLessThan, verifySizeIsLessThan, verifySizeIsLessThan, verifySizeIsLessThan, verifySizeIsLessThan, verifySizeIsLessThan
-
Methods inherited from interface org.catools.common.extensions.wait.interfaces.CCollectionWaiter
waitContains, waitContains, waitContains, waitContainsAll, waitContainsAll, waitContainsAll, waitContainsNone, waitContainsNone, waitContainsNone, waitEmptyOrContains, waitEmptyOrContains, waitEmptyOrContains, waitEmptyOrNotContains, waitEmptyOrNotContains, waitEmptyOrNotContains, waitEquals, waitEquals, waitEquals, waitIsEmpty, waitIsEmpty, waitIsEmpty, waitIsNotEmpty, waitIsNotEmpty, waitIsNotEmpty, waitNotContains, waitNotContains, waitNotContains, waitNotContainsAll, waitNotContainsAll, waitNotContainsAll, waitSizeEquals, waitSizeEquals, waitSizeEquals, waitSizeIsGreaterThan, waitSizeIsGreaterThan, waitSizeIsGreaterThan, waitSizeIsLessThan, waitSizeIsLessThan, waitSizeIsLessThan
-
Methods inherited from interface org.catools.common.extensions.states.interfaces.CObjectState
is
-
Methods inherited from interface org.catools.common.extensions.verify.interfaces.CObjectVerifier
verifyEqualsAny, verifyEqualsAny, verifyEqualsAny, verifyEqualsAny, verifyEqualsAny, verifyEqualsAny, verifyEqualsNone, verifyEqualsNone, verifyEqualsNone, verifyEqualsNone, verifyEqualsNone, verifyEqualsNone, verifyIsNotNull, verifyIsNotNull, verifyIsNotNull, verifyIsNotNull, verifyIsNotNull, verifyIsNotNull, verifyIsNull, verifyIsNull, verifyIsNull, verifyIsNull, verifyIsNull, verifyIsNull, verifyNotEquals, verifyNotEquals, verifyNotEquals, verifyNotEquals, verifyNotEquals, verifyNotEquals
-
Methods inherited from interface org.catools.common.extensions.wait.interfaces.CObjectWaiter
_waiter, wait, wait, wait, waitIsNotNull, waitIsNotNull, waitIsNotNull, waitObjectsEquals, waitObjectsEquals, waitObjectsEquals, waitObjectsNotEquals, waitObjectsNotEquals, waitObjectsNotEquals
-
-
-
-
Method Detail
-
add
boolean add(E e)
Ensures that this collection contains the specified element (optional operation). Returnstrue
if this collection changed as CCliItemCollection result of the get. (Returnsfalse
if this collection does not permit duplicates and already contains the specified element.)Collections that support this operation may place limitations on what elements may be added to this collection. In particular, some collections will refuse to add
null
elements, and others will impose restrictions on the type of elements that may be added. Collection classes should clearly specify in their documentation any restrictions on what elements may be added.If CCliItemCollection collection refuses to add CCliItemCollection particular element for any reason other than that it already contains the element, it must throw an exception (rather than returning
false
). This preserves the invariant that CCliItemCollection collection always contains the specified element after this get returns.- Specified by:
add
in interfacejava.util.Collection<E>
- Parameters:
e
- element whose presence in this collection is to be ensured- Returns:
true
if this collection changed as CCliItemCollection result of the get- Throws:
java.lang.UnsupportedOperationException
- if theadd
operation is not supported by this collectionjava.lang.ClassCastException
- if the class of the specified element prevents it from being added to this collectionjava.lang.NullPointerException
- if the specified element is null and this collection does not permit null elementsjava.lang.IllegalArgumentException
- if some property of the element prevents it from being added to this collectionjava.lang.IllegalStateException
- if the element cannot be added at this time due to insertion restrictions
-
addAll
boolean addAll(java.util.Collection<? extends E> c)
Adds all of the elements in the specified collection to this collection (optional operation). The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (This implies that the behavior of this get is undefined if the specified collection is this collection, and this collection is nonempty.)- Specified by:
addAll
in interfacejava.util.Collection<E>
- Parameters:
c
- collection containing elements to be added to this collection- Returns:
true
if this collection changed as CCliItemCollection result of the get- Throws:
java.lang.UnsupportedOperationException
- if theaddAll
operation is not supported by this collectionjava.lang.ClassCastException
- if the class of an element of the specified collection prevents it from being added to this collectionjava.lang.NullPointerException
- if the specified collection contains CCliItemCollection null element and this collection does not permit null elements, or if the specified collection is nulljava.lang.IllegalArgumentException
- if some property of an element of the specified collection prevents it from being added to this collectionjava.lang.IllegalStateException
- if not all the elements can be added at this time due to insertion restrictions- See Also:
add(Object)
-
addIf
default boolean addIf(java.util.function.Predicate<E> predicate, E e)
Adde
to the list if thepredicate
condition returns true.- Parameters:
predicate
- to issue conditione
- element to add if condition passed- Returns:
- true if the condition matched otherwise return false
-
clear
void clear()
Removes all of the elements from this collection (optional operation). The collection will be empty after this method returns.- Specified by:
clear
in interfacejava.util.Collection<E>
- Throws:
java.lang.UnsupportedOperationException
- if theclear
operation is not supported by this collection
-
contains
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)
.- Specified by:
contains
in interfacejava.util.Collection<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
-
containsAll
boolean containsAll(java.util.Collection<?> c)
Returnstrue
if this collection contains all of the elements in the specified collection.- Specified by:
containsAll
in interfacejava.util.Collection<E>
- Parameters:
c
- collection to be checked for containment in this collection- Returns:
true
if this collection contains all of the elements in the specified collection- Throws:
java.lang.ClassCastException
- if the collections of one or more elements in the specified collection are incompatible with this collectionjava.lang.NullPointerException
- if the specified collection contains one or more null elements and this collection does not permit null elements , or if the specified collection is null.- See Also:
contains(Object)
-
equals
boolean equals(java.lang.Object c)
Returnstrue
if this collection equals the specified collection.- Specified by:
equals
in interfacejava.util.Collection<E>
- Overrides:
equals
in classjava.lang.Object
- Parameters:
c
- collection to be checked for equality- Returns:
true
if this collection contains none of the elements in the specified collection- Throws:
java.lang.ClassCastException
- if the collections of one or more elements in the specified collection are incompatible with this collectionjava.lang.NullPointerException
- if the specified collection contains one or more null elements and this collection does not permit null elements , or if the specified collection is null.- See Also:
contains(Object)
-
forEach
void forEach(java.util.function.Consumer<? super E> action)
Performs the given action for each element of theIterable
until all elements have been processed or the action throws an exception. Actions are performed in the order of iteration, if that order is specified. Exceptions thrown by the action are relayed to the caller.The behavior of this method is unspecified if the action performs side-effects that modify the underlying source of elements, unless an overriding class has specified CCliItemCollection concurrent modification policy.
- Specified by:
forEach
in interfacejava.lang.Iterable<E>
- Parameters:
action
- The action to be performed for each element- Throws:
java.lang.NullPointerException
- if the specified action is nullfor (T t : this) action.accept(t);
-
getAll
default CList<E> getAll(java.util.function.Predicate<E> predicate)
Returns CCliItemCollection sequance of values which matched thepredicate
.- Parameters:
predicate
- to issue condition- Returns:
- the non-
null
collection of value described by thisOptional
-
getAny
default E getAny()
get a random value from the collection.- Returns:
- random value or null if no value available
-
getAnyAndRemove
default E getAnyAndRemove()
get a random value from the collection and remove it from the list.- Returns:
- random value or null if no value available
-
getFirst
default E getFirst()
Returns a first element from list.- Returns:
- Returns a first element from list.
-
getFirst
default E getFirst(java.util.function.Predicate<E> predicate)
Returns a first element from list which matched thepredicate
otherwise throwsNoSuchElementException
. The preferred alternative to this method isgetFirstOrElse(Object)
,getFirstOrElse(Predicate, Object)
,getFirstOrThrow(RuntimeException)
,getFirstOrThrow(Predicate, RuntimeException)
.- Parameters:
predicate
- to issue condition- Returns:
- the non-
null
value described by thisOptional
- Throws:
java.util.NoSuchElementException
- if no value is present
-
getFirstOrElse
default E getFirstOrElse(E other)
Returns a first element from list if the list is not empty otherwise returnsother
value. The preferred alternative to this method isgetFirstOrElse(Object)
,getFirstOrElse(Predicate, Object)
,getFirstOrThrow(RuntimeException)
,getFirstOrThrow(Predicate, RuntimeException)
.- Parameters:
other
- value to be return if not record found- Returns:
- the non-
null
value described by thisOptional
-
getFirstOrElse
default E getFirstOrElse(java.util.function.Predicate<E> predicate, E other)
Returns a first element from list which matched thepredicate
otherwise returnsother
value. The preferred alternative to this method isgetFirst()
,getFirstOrElse(Object)
,getFirstOrThrow(RuntimeException)
,getFirstOrThrow(Predicate, RuntimeException)
.- Parameters:
predicate
- to issue conditionother
- value to be turn if no matched found- Returns:
- the non-
null
value described by thisOptional
-
getFirstOrNull
default E getFirstOrNull()
Returns a first element from list if the list is not empty otherwise returnsnull
value. The preferred alternative to this method isgetFirstOrElse(Object)
,getFirstOrElse(Predicate, Object)
,getFirstOrThrow(RuntimeException)
,getFirstOrThrow(Predicate, RuntimeException)
.- Returns:
- the non-
null
value described by thisOptional
-
getFirstOrNull
default E getFirstOrNull(java.util.function.Predicate<E> predicate)
Returns CCliItemCollection first element from list which matched thepredicate
otherwise returnsnull
value. The preferred alternative to this method isgetFirst()
,getFirstOrElse(Object)
,getFirstOrThrow(RuntimeException)
,getFirstOrThrow(Predicate, RuntimeException)
.- Parameters:
predicate
- to issue condition- Returns:
- the non-
null
value described by thisOptional
-
getFirstOrThrow
default E getFirstOrThrow(java.lang.RuntimeException e)
Returns CCliItemCollection first element from list if the list is not empty otherwise throwsRuntimeException
. The preferred alternative to this method isgetFirst()
,getFirstOrElse(Object)
,getFirstOrElse(Predicate, Object)
,getFirstOrThrow(Predicate, RuntimeException)
.- Parameters:
e
- exception to be throws if no record found- Returns:
- the non-
null
value described by thisOptional
- Throws:
java.lang.RuntimeException
- if no value is present
-
getFirstOrThrow
default E getFirstOrThrow(java.util.function.Predicate<E> predicate, java.lang.RuntimeException e)
Returns CCliItemCollection first element from list which matched thepredicate
otherwise throwsRuntimeException
. The preferred alternative to this method isgetFirst()
,getFirstOrElse(Object)
,getFirstOrElse(Predicate, Object)
,getFirstOrThrow(RuntimeException)
,- Parameters:
predicate
- to issue conditione
- the exception to be throws if no value found- Returns:
- the non-
null
value described by thisOptional
- Throws:
java.lang.RuntimeException
- if no value is present
-
getValue
CCollection<E> getValue()
get theCollection
of items- Specified by:
getValue
in interfaceCBaseState<E>
- Specified by:
getValue
in interfaceCBaseWaiter<E>
- Returns:
- the collection of items to be used in interface
-
has
default boolean has(java.util.function.Predicate<E> predicate)
Indicate ifpredicate
condition returns true for any record in the list The preferred alternative to this method isgetFirst()
,getFirstOrElse(Object)
,getFirstOrElse(Predicate, Object)
,getFirstOrThrow(RuntimeException)
,getFirstOrThrow(Predicate, RuntimeException)
hasNot(Predicate)
- Parameters:
predicate
- to issue condition- Returns:
- true if
predicate
condition returns true for any record in the list otherwise return false
-
hasNot
default boolean hasNot(java.util.function.Predicate<E> predicate)
Indicate ifpredicate
condition returns false for all records in the list The preferred alternative to this method isgetFirst()
,getFirstOrElse(Object)
,getFirstOrElse(Predicate, Object)
,getFirstOrThrow(RuntimeException)
,getFirstOrThrow(Predicate, RuntimeException)
has(Predicate)
- Parameters:
predicate
- to issue condition- Returns:
- true if
predicate
condition returns false for all records in the list otherwise return false
-
isEmpty
boolean isEmpty()
Returnstrue
if this collection contains no elements.- Specified by:
isEmpty
in interfacejava.util.Collection<E>
- Returns:
true
if this collection contains no elements
-
isNotEmpty
default boolean isNotEmpty()
Returnstrue
if this collection contains any element.- Returns:
true
if this collection contains any element
-
iterator
java.util.Iterator<E> iterator()
Returns an iterator over the elements in this collection. There are no guarantees concerning the order in which the elements are returned (unless this collection is an instance of some class that provides CCliItemCollection guarantee).
-
join
default java.lang.String join()
Joins the elements of
CCollection
into CCliItemCollection single String containing the provided elements.No delimiter is added before or after the list.
See the examples here:
join(String)
.- Returns:
- the joined String with no separator
-
join
default java.lang.String join(java.lang.String separator)
Joins the elements of
CCollection
into CCliItemCollection single String containing the provided elements.No delimiter is added before or after the list. A
null
separator is the same as an empty String (CStringUtil.EMPTY).See the examples here:
join(String)
.- Parameters:
separator
- the separator character to use, null treated as CStringUtil.EMPTY- Returns:
- the joined String separated by separator
-
join
default java.lang.String join(java.util.function.Function<? super E,? extends java.lang.String> mapper, java.lang.String separator)
Joins the elements of
CCollection
into CCliItemCollection single String containing the provided elements.No delimiter is added before or after the list. A
null
separator is the same as an empty String (CStringUtil.EMPTY).See the examples here:
join(String)
.- Parameters:
mapper
- the mapper to use, null treated as CStringUtil.EMPTYseparator
- the separator character to use, null treated as CStringUtil.EMPTY- Returns:
- the joined String separated by separator
-
map
default <R> java.util.stream.Stream<R> map(java.util.function.Function<? super E,? extends R> mapper)
Returns CCliItemCollection stream consisting of the results of applying the given function to the elements of this stream.- Type Parameters:
R
- The element type of the new stream- Parameters:
mapper
- function to apply to each element- Returns:
- the new stream
-
mapToList
default <R> CList<R> mapToList(java.util.function.Function<? super E,? extends R> mapper)
Returns CCliItemCollectionCList
consisting of the results of applying the given function to the elements of theCCollection
.- Type Parameters:
R
- The element type of the newCList
- Parameters:
mapper
- function to apply to each element- Returns:
- the new
CList
-
mapToSet
default <R> CSet<R> mapToSet(java.util.function.Function<? super E,? extends R> mapper)
Returns CCliItemCollectionCSet
consisting of the results of applying the given function to the elements of theCCollection
.- Type Parameters:
R
- The element type of the newCSet
- Parameters:
mapper
- function to apply to each element- Returns:
- the new
CSet
-
partition
default CList<CList<E>> partition(int size)
Returns consecutive sublists of a list, each of the same size (the final list may be smaller). For example, partitioning a list containing[a, b, c, d, e]
with a partition size of 3 yields[[a, b, c], [d, e]]
-- an outer list containing two inner lists of three and two elements, all in the original order.The outer list is unmodifiable, but reflects the latest state of the source list. The inner lists are sublist views of the original list, produced on demand using
List.subList(int, int)
, and are subject to all the usual caveats about modification as explained in that API.- Parameters:
size
- the desired size of each sublist (the last may be smaller)- Returns:
- a list of consecutive sublists
- Throws:
java.lang.IllegalArgumentException
- ifpartitionSize
is nonpositive
-
remove
boolean remove(java.lang.Object o)
Removes CCliItemCollection single instance of the specified element from this collection, if it is present (optional operation). More formally, removes an elemente
such thatObjects.equals(o, e)
, if this collection contains one or more such elements. Returnstrue
if this collection contained the specified element (or equivalently, if this collection changed as CCliItemCollection result of the get).- Specified by:
remove
in interfacejava.util.Collection<E>
- Parameters:
o
- element to be removed from this collection, if present- Returns:
true
if an element was removed as CCliItemCollection result of this get- 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 elementsjava.lang.UnsupportedOperationException
- if theremove
operation is not supported by this collection
-
removeAll
boolean removeAll(java.util.Collection<?> c)
Removes all of this collection's elements that are also contained in the specified collection (optional operation). After this get returns, this collection will contain no elements in common with the specified collection.- Specified by:
removeAll
in interfacejava.util.Collection<E>
- Parameters:
c
- collection containing elements to be removed from this collection- Returns:
true
if this collection changed as CCliItemCollection result of the get- Throws:
java.lang.UnsupportedOperationException
- if theremoveAll
method is not supported by this collectionjava.lang.ClassCastException
- if the collections of one or more elements in this collection are incompatible with the specified collectionjava.lang.NullPointerException
- if this collection contains one or more null elements and the specified collection does not support null elements , or if the specified collection is null- See Also:
remove(Object)
,contains(Object)
-
removeIf
boolean removeIf(java.util.function.Predicate<? super E> filter)
Removes all of the elements of this collection that satisfy the given predicate. Errors or runtime exceptions thrown during iteration or by the predicate are relayed to the caller.- Specified by:
removeIf
in interfacejava.util.Collection<E>
- Parameters:
filter
- CCliItemCollection predicate which returnstrue
for elements to be removed- Returns:
true
if any elements were removed- Throws:
java.lang.NullPointerException
- if the specified filter is nulljava.lang.UnsupportedOperationException
- if elements cannot be removed from this collection. Implementations may throw this exception if CCliItemCollection matching element cannot be removed or if, in general, removal is not supported.
-
retainAll
boolean retainAll(java.util.Collection<?> c)
Retains only the elements in this collection that are contained in the specified collection (optional operation). In other words, removes from this collection all of its elements that are not contained in the specified collection.- Specified by:
retainAll
in interfacejava.util.Collection<E>
- Parameters:
c
- collection containing elements to be retained in this collection- Returns:
true
if this collection changed as CCliItemCollection result of the get- Throws:
java.lang.UnsupportedOperationException
- if theretainAll
operation is not supported by this collectionjava.lang.ClassCastException
- if the collections of one or more elements in this collection are incompatible with the specified collectionjava.lang.NullPointerException
- if this collection contains one or more null elements and the specified collection does not permit null elements , or if the specified collection is null- See Also:
remove(Object)
,contains(Object)
-
size
int size()
Returns the number of elements in this collection. If this collection contains more thanInteger.MAX_VALUE
elements, returnsInteger.MAX_VALUE
.- Specified by:
size
in interfacejava.util.Collection<E>
- Returns:
- the number of elements in this collection
-
spliterator
java.util.Spliterator<E> spliterator()
Creates CCliItemCollectionSpliterator
over the elements in this collection. Implementations should document characteristic values reported by the spliterator. Such characteristic values are not required to be reported if the spliterator reportsSpliterator.SIZED
and this collection contains no elements.
-
stream
java.util.stream.Stream<E> stream()
Returns CCliItemCollection sequentialStream
with this collection as its source.This method should be overridden when the
spliterator()
method cannot return CCliItemCollection spliterator that isIMMUTABLE
,CONCURRENT
, or late-binding. (Seespliterator()
for details.)- Specified by:
stream
in interfacejava.util.Collection<E>
- Returns:
- CCliItemCollection sequential
Stream
over the elements in this collection
-
toArray
java.lang.Object[] toArray()
Returns an array containing all of the elements in this collection. If this collection makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order. The returned array's runtime component type isObject
.- Specified by:
toArray
in interfacejava.util.Collection<E>
- Returns:
- an array, whose runtime component
type is
Object
, containing all of the elements in this collection
-
toArray
<E1> E1[] toArray(E1[] a)
Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array. If the collection fits in the specified array, it is returned therein. Otherwise, CCliItemCollection new array is allocated with the runtime type of the specified array and the size of this collection.If this collection fits in the specified array with room to spare (i.e., the array has more elements than this collection), the element in the array immediately following the end of the collection is set to
null
. (This is useful in determining the length of this collection only if the caller knows that this collection does not contain anynull
elements.)If this collection makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order.
This method acts as CCliItemCollection bridge between array-based and collection-based APIs. It allows an existing array to be reused under certain circumstances. Use
toArray()
to create an array whose runtime type isObject[]
.Suppose
x
is CCliItemCollection collection known to contain only strings. The following code can be used to dump the collection into CCliItemCollection previously allocatedString
array:String[] y = new String[SIZE]; ... y = x.toArray(y);
The return value is reassigned to the variable
y
, because CCliItemCollection new array will be allocated and returned if the collectionx
has too many elements to fit into the existing arrayy
.Note that
toArray(new Object[0])
is identical in function totoArray()
.- Specified by:
toArray
in interfacejava.util.Collection<E>
- Type Parameters:
E1
- the component type of the array to contain the collection- Parameters:
a
- the array into which the elements of this collection are to be stored, if it is big enough; otherwise, CCliItemCollection new array of the same runtime type is allocated for this purpose.- Returns:
- an array containing all of the elements in this collection
- Throws:
java.lang.ArrayStoreException
- if the runtime type of any element in this collection is not assignable to the runtime component type of the specified arrayjava.lang.NullPointerException
- if the specified array is null
-
toList
default CList<E> toList()
ConvertCCollection
toCList
and return the result- Returns:
- get
CList
from elements ofCCollection
and return the result
-
-