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>>
- Direct Known Subclasses:
CTestResults
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 Instance Methods Concrete Methods Modifier and Type Method Description boolean
_useWaiter()
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.CList<E>
set(java.util.Collection<? extends E> items)
Clear list and appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator (optional operation).java.util.stream.Stream<E>
stream()
Returns CCliItemCollection 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, equals, 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, _verifyWithDefaultMessage, _verifyWithDefaultMessage, getDefaultMessage, getEntityDescription
-
Methods inherited from interface org.catools.common.extensions.wait.interfaces.CBaseWaiter
getDefaultWaitInSeconds, getDefaultWaitIntervalInMilliSeconds
-
Methods inherited from interface org.catools.common.collections.interfaces.CCollection
add, addAll, addIf, clear, contains, containsAll, equals, forEach, getAll, getAny, getAnyAndRemove, getFirst, getFirst, getFirstOrElse, getFirstOrElse, getFirstOrNull, getFirstOrNull, getFirstOrThrow, getFirstOrThrow, has, hasNot, isEmpty, isNotEmpty, iterator, join, join, join, map, mapToList, mapToSet, partition, remove, removeAll, removeIf, retainAll, size, spliterator, toArray, toArray, toList, toSet
-
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.extensions.states.interfaces.CIterableState
containsAll, containsNone, containsNone, emptyOrContains, emptyOrNotContains, isEqual, isEqual, 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, 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
-
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray
-
-
-
-
Method Detail
-
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 isCCollection.getFirstOrElse(Object)
,CCollection.getFirstOrElse(Predicate, Object)
,CCollection.getFirstOrThrow(RuntimeException)
,CCollection.getFirstOrThrow(Predicate, RuntimeException)
.- 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:
CCollection.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:
CCollection.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
-
set
public CList<E> set(java.util.Collection<? extends E> items)
Clear list and appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator (optional operation). The behavior of this operation is undefined if the specified collection is modified while the operation is in progress.- Parameters:
items
- collection containing elements to be added to this list- Returns:
- current instance of
CList
- Throws:
java.lang.UnsupportedOperationException
- if theaddAll
operation is not supported by this listjava.lang.ClassCastException
- if the class of an element of the specified collection prevents it from being added to this listjava.lang.NullPointerException
- if the specified collection contains one or more null elements and this list 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 list- See Also:
ArrayList.add(Object)
-
stream
public java.util.stream.Stream<E> stream()
Description copied from interface:CCollection
Returns CCliItemCollection sequentialStream
with this collection as its source.This method should be overridden when the
CCollection.spliterator()
method cannot return CCliItemCollection spliterator that isIMMUTABLE
,CONCURRENT
, or late-binding. (SeeCCollection.spliterator()
for details.)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.util.AbstractCollection<E>
-
_useWaiter
public boolean _useWaiter()
- Specified by:
_useWaiter
in interfaceCBaseVerifier<E>
-
-