There are several extensions to MutableCollection, including MutableList, MutableSet, and MutableBag.
| Modifier and Type | Method and Description |
|---|---|
| public boolean | |
| public default <K, V> MutableMap | aggregateBy(Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Function2<? super V, ? super T, ? extends V> nonMutatingAggregator)
Overrides default org. Applies an aggregate function over the iterable grouping results into a map based on the specific groupBy function. |
| public default <K, V> MutableMap | aggregateInPlaceBy(Function<? super T, ? extends K> groupBy, Function0<? extends V> zeroValueFactory, Procedure2<? super V, ? super T> mutatingAggregator)
Overrides default org. Applies an aggregate procedure over the iterable grouping results into a Map based on the specific groupBy function. |
| public MutableCollection | Returns: a synchronized view of this collection.Returns a synchronized wrapper backed by this collection. |
| public MutableCollection | Returns: an unmodifiable view of this collection.Returns an unmodifiable view of this collection. |
| public <V> MutableCollection | collect(Function<? super T, ? extends V> function)
Redeclares org. Returns a new MutableCollection with the results of applying the specified function to each element of the source collection. |
| public default MutableBooleanCollection | collectBoolean(BooleanFunction<? super T> booleanFunction)
Implements org. Returns a new primitive |
| public default MutableByteCollection | collectByte(ByteFunction<? super T> byteFunction)
Implements org. Returns a new primitive |
| public default MutableCharCollection | collectChar(CharFunction<? super T> charFunction)
Implements org. Returns a new primitive |
| public default MutableDoubleCollection | collectDouble(DoubleFunction<? super T> doubleFunction)
Implements org. Returns a new primitive |
| public default MutableFloatCollection | collectFloat(FloatFunction<? super T> floatFunction)
Implements org. Returns a new primitive |
| public <V> MutableCollection | collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function)
Redeclares org. Returns a new MutableCollection with the results of applying the specified function to each element of the source collection, but only for elements that evaluate to true for the specified predicate. |
| public default MutableIntCollection | collectInt(IntFunction<? super T> intFunction)
Implements org. Returns a new primitive |
| public default MutableLongCollection | collectLong(LongFunction<? super T> longFunction)
Implements org. Returns a new primitive |
| public default MutableShortCollection | collectShort(ShortFunction<? super T> shortFunction)
Implements org. Returns a new primitive |
| public <P, V> MutableCollection | collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter)
Redeclares org. Same as |
| public default <V> MutableBag | countBy(Function<? super T, ? extends V> function)
Overrides default org. This method will count the number of occurrences of each value calculated by applying the function to each element of the collection. |
| public default <V> MutableBag | countByEach(Function<? super T, ? extends Iterable<V>> function)
Overrides default org. This method will count the number of occurrences of each value calculated by applying the function to each element of the collection. |
| public default <V, P> MutableBag | countByWith(Function2<? super T, ? super P, ? extends V> function, P parameter)
Overrides default org. 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. |
| public <V> MutableCollection | Returns: a new flattened collection produced by applying the givenfunctionThe function)Function to applyRedeclares org.
|
| public default <P, V> MutableCollection | flatCollectWith(Function2<? super T, ? super P, ? extends Iterable<V>> function, P parameter)
Overrides default org. Same as flatCollect, only with a Function2 that is passed an extra parameter. |
| public <V> MutableMultimap | groupBy(Function<? super T, ? extends V> function)
Redeclares org. For each element of the iterable, the function is evaluated and the results of these evaluations are collected into a new multimap, where the transformed value is the key and the original values are added to the same (or similar) species of collection as the source iterable. |
| public <V> MutableMultimap | groupByEach(Function<? super T, ? extends Iterable<V>> function)
Redeclares org. Similar to |
| public default <V> MutableMap | groupByUniqueKey(Function<? super T, ? extends V> function)
Implements org. For each element of the iterable, the function is evaluated, and the results of these evaluations are collected into a new map, where the transformed value is the key. |
| public <IV, P> IV | injectIntoWith(IV injectValue, Function3<? super IV, ? super T, ? super P, ? extends IV> function, P parameter)
Returns the final result of evaluating function using each element of the iterable, the previous evaluation result and the parameters. |
| public MutableCollection | |
| public PartitionMutableCollection | partition(Predicate<? super T> predicate)
Redeclares org. Filters a collection into a PartitionedIterable based on the evaluation of the predicate. |
| public <P> PartitionMutableCollection | partitionWith(Predicate2<? super T, ? super P> predicate, P parameter)
Redeclares org. Filters a collection into a PartitionIterable based on the evaluation of the predicate. |
| public MutableCollection | reject(Predicate<? super T> predicate)
Redeclares org. Returns a MutableCollection with all elements that evaluate to false for the specified predicate. |
| public <P> MutableCollection | rejectWith(Predicate2<? super T, ? super P> predicate, P parameter)
Redeclares org. Returns a MutableCollection with all elements that evaluate to false for the specified predicate2 and parameter. |
| public boolean | |
| public boolean | |
| public <P> boolean | removeIfWith(Predicate2<? super T, ? super P> predicate, P parameter)
Removes all elements in the collection that evaluate to true for the specified predicate2 and parameter. |
| public boolean | |
| public MutableCollection | select(Predicate<? super T> predicate)
Redeclares org. Returns a MutableCollection with all elements that evaluate to true for the specified predicate. |
| public <P> Twin | selectAndRejectWith(Predicate2<? super T, ? super P> predicate, P parameter)
Deprecated
since 6.0 use
RichIterable#partitionWith(Predicate2, Object) instead.
Filters a collection into two separate collections based on a predicate returned via a Pair. |
| public <S> MutableCollection | selectInstancesOf(Class<S> clazz)
Redeclares org. Returns all elements of the source collection that are instances of the Class |
| public <P> MutableCollection | selectWith(Predicate2<? super T, ? super P> predicate, P parameter)
Redeclares org. Returns a MutableCollection with all elements that evaluate to true for the specified predicate2 and parameter. |
| public <V> MutableObjectDoubleMap | sumByDouble(Function<? super T, ? extends V> groupBy, DoubleFunction<? super T> function)
Redeclares org. Groups and sums the values using the two specified functions. |
| public <V> MutableObjectDoubleMap | sumByFloat(Function<? super T, ? extends V> groupBy, FloatFunction<? super T> function)
Redeclares org. Groups and sums the values using the two specified functions. |
| public <V> MutableObjectLongMap | sumByInt(Function<? super T, ? extends V> groupBy, IntFunction<? super T> function)
Redeclares org. Groups and sums the values using the two specified functions. |
| public <V> MutableObjectLongMap | sumByLong(Function<? super T, ? extends V> groupBy, LongFunction<? super T> function)
Redeclares org. Groups and sums the values using the two specified functions. |
| public MutableCollection | tap(Procedure<? super T> procedure)
Redeclares org. Executes the Procedure for each element in the iterable and returns |
| public default Object[] | toArray()
Overrides default org. Implements java. Returns an array containing all of the elements in this collection. |
| public default <T1> T1[] | toArray(T1[] a)
Overrides default org. Implements java. Returns an array containing all of the elements in this collection; the runtime type of the returned array is that of the specified array. |
| public ImmutableCollection | |
| public MutableCollection | with(T element)
This method allows mutable and fixed size collections the ability to add elements to their existing elements. |
| public MutableCollection | |
| public MutableCollection | without(T element)
This method allows mutable and fixed size collections the ability to remove elements from their existing elements. |
| public MutableCollection | withoutAll(Iterable<? extends T> elements)
This method allows mutable and fixed size collections the ability to remove multiple elements from their existing elements. |
| public <S> MutableCollection | zip(Iterable<S> that)
Redeclares org.
Deprecated
in 6.0. Use
OrderedIterable#zip(Iterable) instead.
Returns a |
| public MutableCollection | zipWithIndex()
Redeclares org.
Deprecated
in 6.0. Use
OrderedIterable#zipWithIndex() instead.
Zips this |