Interface CIterable<E>

    • Method Detail

      • equals

        boolean equals​(java.lang.Object c)
        Returns true if this collection equals the specified collection.
        Overrides:
        equals in class java.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 collection
        java.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:
        CIterableState.contains(Object)
      • forEach

        default void forEach​(java.util.function.Consumer<? super E> action)
        Performs the given action for each element of the Iterable 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 interface java.lang.Iterable<E>
        Parameters:
        action - The action to be performed for each element
        Throws:
        java.lang.NullPointerException - if the specified action is null
        
                for (T t : this)
                  action.accept(t);
                
              
      • getAll

        default CList<E> getAll​(java.util.function.Predicate<E> predicate)
        Returns CCliItemCollection sequance of values which matched the predicate.
        Parameters:
        predicate - to issue condition
        Returns:
        the non-null collection of value described by this Optional
      • getAny

        default E getAny()
        get a random value from the collection.
        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.
      • getFirstOrThrow

        default E getFirstOrThrow​(java.util.function.Predicate<E> predicate,
                                  java.lang.RuntimeException e)
        Returns CCliItemCollection first element from list which matched the predicate otherwise throws RuntimeException. The preferred alternative to this method is getFirst(), getFirstOrElse(Object), getFirstOrElse(Predicate, Object), getFirstOrThrow(RuntimeException),
        Parameters:
        predicate - to issue condition
        e - the exception to be throws if no value found
        Returns:
        the non-null value described by this Optional
        Throws:
        java.lang.RuntimeException - if no value is present
      • 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).
        Specified by:
        iterator in interface java.lang.Iterable<E>
        Returns:
        an Iterator over the elements in this collection
      • 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.EMPTY
        separator - 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 CCliItemCollection CList consisting of the results of applying the given function to the elements of the CCollection.
        Type Parameters:
        R - The element type of the new CList
        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 CCliItemCollection CSet consisting of the results of applying the given function to the elements of the CCollection.
        Type Parameters:
        R - The element type of the new CSet
        Parameters:
        mapper - function to apply to each element
        Returns:
        the new CSet
      • spliterator

        default java.util.Spliterator<E> spliterator()
        Creates CCliItemCollection Spliterator 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 reports Spliterator.SIZED and this collection contains no elements.
        Specified by:
        spliterator in interface java.lang.Iterable<E>
        Returns:
        CCliItemCollection Spliterator over the elements in this collection
      • stream

        default java.util.stream.Stream<E> stream()
        Returns CCliItemCollection sequential Stream with this collection as its source.

        This method should be overridden when the spliterator() method cannot return CCliItemCollection spliterator that is IMMUTABLE, CONCURRENT, or late-binding. (See spliterator() for details.)

        Returns:
        CCliItemCollection sequential Stream over the elements in this collection
      • toArray

        default 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 is Object.
        Returns:
        an array, whose runtime component type is Object, containing all of the elements in this collection
      • toArray

        default <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 any null 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.

        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 array
        java.lang.NullPointerException - if the specified array is null
      • toList

        default CList<E> toList()
        Convert CCollection to CList and return the result
        Returns:
        get CList from elements of CCollection and return the result
      • toSet

        default CSet<E> toSet()
        Convert CCollection to CSet and return the result
        Returns:
        get CSet from elements of CCollection and return the result