Class AbstractImmutableCollection<T>

    • Constructor Detail

      • AbstractImmutableCollection

        public AbstractImmutableCollection()
    • Method Detail

      • reduce

        public java.util.Optional<T> reduce​(java.util.function.BinaryOperator<T> accumulator)
        Description copied from interface: RichIterable
        This method produces the equivalent result as Stream.reduce(BinaryOperator).
        Specified by:
        reduce in interface RichIterable<T>
      • add

        public boolean add​(T t)
        Specified by:
        add in interface java.util.Collection<T>
      • remove

        public boolean remove​(java.lang.Object o)
        Specified by:
        remove in interface java.util.Collection<T>
      • addAll

        public boolean addAll​(java.util.Collection<? extends T> collection)
        Specified by:
        addAll in interface java.util.Collection<T>
      • removeAll

        public boolean removeAll​(java.util.Collection<?> collection)
        Specified by:
        removeAll in interface java.util.Collection<T>
      • retainAll

        public boolean retainAll​(java.util.Collection<?> collection)
        Specified by:
        retainAll in interface java.util.Collection<T>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<T>
      • removeAllFrom

        protected void removeAllFrom​(java.lang.Iterable<? extends T> elements,
                                     MutableCollection<T> result)
      • chunk

        public RichIterable<RichIterable<T>> chunk​(int size)
        Description copied from interface: RichIterable
        Partitions elements in fixed size chunks.
        Specified by:
        chunk in interface RichIterable<T>
        Parameters:
        size - the number of elements per chunk
        Returns:
        A RichIterable containing RichIterables of size size, except the last will be truncated if the elements don't divide evenly.
      • countBy

        public <V> ImmutableBag<V> countBy​(Function<? super T,​? extends V> function)
        Description copied from interface: RichIterable
        This method will count the number of occurrences of each value calculated by applying the function to each element of the collection.
        Specified by:
        countBy in interface ImmutableCollection<T>
        Specified by:
        countBy in interface RichIterable<T>
        Since:
        9.0
      • countByWith

        public <V,​P> ImmutableBag<V> countByWith​(Function2<? super T,​? super P,​? extends V> function,
                                                       P parameter)
        Description copied from interface: RichIterable
        This method will count the number of occurrences of each value calculated by applying the function to each element of the collection with the specified parameter as the second argument.
        Specified by:
        countByWith in interface ImmutableCollection<T>
        Specified by:
        countByWith in interface RichIterable<T>
        Since:
        9.0
      • stream

        public java.util.stream.Stream<T> stream()
        Specified by:
        stream in interface java.util.Collection<T>
        Specified by:
        stream in interface ImmutableCollection<T>
        Since:
        9.0
      • parallelStream

        public java.util.stream.Stream<T> parallelStream()
        Specified by:
        parallelStream in interface java.util.Collection<T>
        Specified by:
        parallelStream in interface ImmutableCollection<T>
        Since:
        9.0
      • spliterator

        public java.util.Spliterator<T> spliterator()
        Specified by:
        spliterator in interface java.util.Collection<T>
        Specified by:
        spliterator in interface ImmutableCollection<T>
        Specified by:
        spliterator in interface java.lang.Iterable<T>
        Since:
        9.0