Package org.catools.common.collections
Class CList<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<E>
-
- org.catools.common.collections.CList<E>
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<E>
,java.util.Collection<E>
,java.util.List<E>
,java.util.RandomAccess
,CCollection<E>
,CIterable<E>
,CBaseState<java.lang.Iterable<E>>
,CCollectionState<E>
,CIterableState<E>
,CObjectState<java.lang.Iterable<E>>
,CBaseVerifier<java.lang.Iterable<E>>
,CCollectionVerifier<E>
,CIterableVerifier<E>
,CObjectVerifier<java.lang.Iterable<E>,CIterableState<E>>
,CBaseWaiter<java.lang.Iterable<E>>
public class CList<E> extends java.util.ArrayList<E> implements CCollection<E>, java.util.List<E>
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface org.catools.common.extensions.states.interfaces.CBaseState
serialVersionUID
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
_useWaiter()
boolean
equals(java.lang.Object c)
Returnstrue
if this collection equals the specified collection.CCollection<E>
getBaseValue()
Implement the getValue method ofCCollection
int
indexOf(java.util.function.Predicate<E> predicate)
Returns the index of first element from list which matched thepredicate
or -1 if no match found.java.lang.String
join(int fromIndex, int toIndex)
Joins the elements ofCList
into a single String containing the provided elements.java.lang.String
join(int fromIndex, int toIndex, java.lang.String separator)
Joins the elements ofCList
into a single String containing the provided elements.static <C> CList<C>
of(C... c)
static <C> CList<C>
of(java.lang.Iterable<C> iterable)
static <C> CList<C>
of(java.util.stream.Stream<C> stream)
java.util.stream.Stream<E>
stream()
Returns sequentialStream
with this collection as its source.java.lang.String
toString()
-
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.catools.common.extensions.verify.interfaces.CBaseVerifier
_verify, _verify, _verify, _verify, _verify, _verify, _verify, _verify, _verify, getDefaultMessage, getDefaultMessage, getVerifyMessagePrefix
-
Methods inherited from interface org.catools.common.extensions.wait.interfaces.CBaseWaiter
getDefaultWaitInSeconds, getDefaultWaitIntervalInMilliSeconds
-
Methods inherited from interface org.catools.common.collections.interfaces.CCollection
addIf, contains, getAnyAndRemove, isEmpty, partition, removeIf, spliterator, toMap, toMap, toMap
-
Methods inherited from interface org.catools.common.extensions.states.interfaces.CCollectionState
sizeEquals, sizeIsGreaterThan, sizeIsLessThan
-
Methods inherited from interface org.catools.common.extensions.verify.interfaces.CCollectionVerifier
_toState, verifySizeEquals, verifySizeEquals, verifySizeIsGreaterThan, verifySizeIsGreaterThan, verifySizeIsLessThan, verifySizeIsLessThan
-
Methods inherited from interface org.catools.common.collections.interfaces.CIterable
getAll, getAny, getDisjunction, getFirst, getFirst, getFirstOrAny, getFirstOrElse, getFirstOrElse, getFirstOrElse, getFirstOrElseGet, getFirstOrElseGet, getFirstOrNull, getFirstOrNull, getFirstOrThrow, getFirstOrThrow, getIntersection, getUnion, has, hasNot, join, join, join, map, mapToList, mapToSet, toList, toSet
-
Methods inherited from interface org.catools.common.extensions.states.interfaces.CIterableState
containsAll, containsAny, containsNone, containsNone, emptyOrContains, emptyOrNotContains, isEqual, isEqual, isNotEmpty, notContains, notContainsAll, notContainsAll
-
Methods inherited from interface org.catools.common.extensions.verify.interfaces.CIterableVerifier
verifyContains, verifyContains, verifyContainsAll, verifyContainsAll, verifyContainsNone, verifyContainsNone, verifyEmptyOrContains, verifyEmptyOrContains, verifyEmptyOrNotContains, verifyEmptyOrNotContains, verifyEquals, verifyEquals, verifyHas, verifyHas, verifyHasNot, verifyHasNot, verifyIsEmpty, verifyIsEmpty, verifyIsNotEmpty, verifyIsNotEmpty, verifyNotContains, verifyNotContains, verifyNotContainsAll, verifyNotContainsAll
-
Methods inherited from interface org.catools.common.extensions.states.interfaces.CObjectState
equalsAny, equalsAny, equalsNone, equalsNone, isNotNull, isNull, notEqual, test
-
Methods inherited from interface org.catools.common.extensions.verify.interfaces.CObjectVerifier
verifyEqualsAny, verifyEqualsAny, verifyEqualsNone, verifyEqualsNone, verifyIsNotNull, verifyIsNotNull, verifyIsNull, verifyIsNull, verifyNotEquals, verifyNotEquals
-
-
-
-
Method Detail
-
of
public static <C> CList<C> of(C... c)
-
of
public static <C> CList<C> of(java.util.stream.Stream<C> stream)
-
of
public static <C> CList<C> of(java.lang.Iterable<C> iterable)
-
getBaseValue
public CCollection<E> getBaseValue()
Implement the getValue method ofCCollection
- Specified by:
getBaseValue
in interfaceCBaseState<E>
- Specified by:
getBaseValue
in interfaceCCollection<E>
- Returns:
- current instance of
CList
-
indexOf
public int indexOf(java.util.function.Predicate<E> predicate)
Returns the index of first element from list which matched thepredicate
or -1 if no match found. The preferred alternative to this method isCIterable.getFirstOrElse(Object)
,CIterable.getFirstOrElse(Predicate, Object)
,CIterable.getFirstOrThrow(RuntimeException)
,CIterable.getFirstOrThrow(Predicate, Supplier)
.- Parameters:
predicate
- to issue condition- Returns:
- index of element in collection ot -1 if no match found
-
join
public java.lang.String join(int fromIndex, int toIndex)
Joins the elements of
CList
into a single String containing the provided elements.No delimiter is added before or after the list.
See the examples here:
CIterable.join(String)
.- Parameters:
fromIndex
- low endpoint (inclusive) of the subListtoIndex
- high endpoint (exclusive) of the subList- Returns:
- the joined String with no separator
-
join
public java.lang.String join(int fromIndex, int toIndex, java.lang.String separator)
Joins the elements of
CList
into a 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:
CIterable.join(String)
.- Parameters:
fromIndex
- low endpoint (inclusive) of the subListtoIndex
- high endpoint (exclusive) of the subListseparator
- the separator character to use, null treated as CStringUtil.EMPTY- Returns:
- the joined String separated by separator
-
stream
public java.util.stream.Stream<E> stream()
Description copied from interface:CCollection
Returns sequentialStream
with this collection as its source.This method should be overridden when the
CCollection.spliterator()
method cannot return spliterator that isIMMUTABLE
,CONCURRENT
, or late-binding. (SeeCCollection.spliterator()
for details.)
-
equals
public boolean equals(java.lang.Object c)
Description copied from interface:CIterable
Returnstrue
if this collection equals the specified collection.- Specified by:
equals
in interfaceCIterable<E>
- Specified by:
equals
in interfacejava.util.Collection<E>
- Specified by:
equals
in interfacejava.util.List<E>
- Overrides:
equals
in classjava.util.ArrayList<E>
- Parameters:
c
- collection to be checked for equality- Returns:
true
if this collection contains none of the elements in the specified collection- See Also:
CIterableState.contains(Object)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.util.AbstractCollection<E>
-
_useWaiter
public boolean _useWaiter()
- Specified by:
_useWaiter
in interfaceCBaseVerifier<E>
-
-