| Modifier and Type | Method and Description |
|---|---|
| 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 MutableStack | |
| public MutableStack | |
| public void | |
| public <V> MutableStack | collect(Function<? super T, ? extends V> function)
Redeclares org. Returns a new collection with the results of applying the specified function on each element of the source collection. |
| public MutableBooleanStack | collectBoolean(BooleanFunction<? super T> booleanFunction)
Redeclares org. Returns a new primitive |
| public MutableByteStack | collectByte(ByteFunction<? super T> byteFunction)
Redeclares org. Returns a new primitive |
| public MutableCharStack | collectChar(CharFunction<? super T> charFunction)
Redeclares org. Returns a new primitive |
| public MutableDoubleStack | collectDouble(DoubleFunction<? super T> doubleFunction)
Redeclares org. Returns a new primitive |
| public MutableFloatStack | collectFloat(FloatFunction<? super T> floatFunction)
Redeclares org. Returns a new primitive |
| public <V> MutableStack | collectIf(Predicate<? super T> predicate, Function<? super T, ? extends V> function)
Redeclares org. Returns a new collection with the results of applying the specified function on each element of the source collection, but only for those elements which return true upon evaluation of the predicate. |
| public MutableIntStack | collectInt(IntFunction<? super T> intFunction)
Redeclares org. Returns a new primitive |
| public MutableLongStack | collectLong(LongFunction<? super T> longFunction)
Redeclares org. Returns a new primitive |
| public MutableShortStack | collectShort(ShortFunction<? super T> shortFunction)
Redeclares org. Returns a new primitive |
| public <P, V> MutableStack | collectWith(Function2<? super T, ? super P, ? extends V> function, P parameter)
Redeclares org. Same as |
| public default <V> MutableStack | collectWithIndex(ObjectIntToObjectFunction<? super T, ? extends V> function)
Overrides default org. Returns a new OrderedIterable using results obtained by applying the specified function to each element and its corresponding index. |
| 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 MutableStack | distinct()
Redeclares org. Returns a new |
| public MutableStack | dropWhile(Predicate<? super T> predicate)
Redeclares org. Returns the final elements that do not satisfy the Predicate. |
| public <V> MutableStack | flatCollect(Function<? super T, ? extends Iterable<V>> function)
Redeclares org.
|
| public default <P, V> MutableStack | 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> MutableListMultimap | 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> MutableListMultimap | 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 PartitionMutableStack | partition(Predicate<? super T> predicate)
Redeclares org. Filters a collection into a PartitionedIterable based on the evaluation of the predicate. |
| public PartitionMutableStack | partitionWhile(Predicate<? super T> predicate)
Redeclares org. Returns a Partition of the initial elements that satisfy the Predicate and the remaining elements. |
| public <P> PartitionMutableStack | 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 T | |
| public ListIterable | pop(int count)
Removes and returns a ListIterable of the number of elements specified by the count, beginning with the top of the stack. |
| public <R extends Collection | pop(int count, R targetCollection)
Removes and returns a ListIterable of the number of elements specified by the count, beginning with the top of the stack and puts them into the targeted collection type. |
| public <R extends MutableStack | pop(int count, R targetStack)
Removes and returns a ListIterable of the number of elements specified by the count, beginning with the top of the stack and puts them into a new stack. |
| public void | |
| public default <K> MutableMap | reduceBy(Function<? super T, ? extends K> groupBy, Function2<? super T, ? super T, ? extends T> reduceFunction)
Overrides default org. Applies an aggregate function over the iterable grouping results into a map based on the specific groupBy function. |
| public MutableStack | reject(Predicate<? super T> predicate)
Redeclares org. Returns all elements of the source collection that return false when evaluating of the predicate. |
| public <P> MutableStack | rejectWith(Predicate2<? super T, ? super P> predicate, P parameter)
Redeclares org. Similar to |
| public MutableStack | select(Predicate<? super T> predicate)
Redeclares org. Returns all elements of the source collection that return true when evaluating the predicate. |
| public <S> MutableStack | selectInstancesOf(Class<S> clazz)
Redeclares org. Returns all elements of the source collection that are instances of the Class |
| public <P> MutableStack | selectWith(Predicate2<? super T, ? super P> predicate, P parameter)
Redeclares org. Similar to |
| 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 MutableStack | takeWhile(Predicate<? super T> predicate)
Redeclares org. Returns the initial elements that satisfy the Predicate. |
| public MutableStack | tap(Procedure<? super T> procedure)
Redeclares org. Executes the Procedure for each element in the iterable and returns |
| public <S> MutableStack | zip(Iterable<S> that)
Redeclares org. Returns a |
| public MutableStack | zipWithIndex()
Redeclares org. Zips this |
| aggregateBy | back to summary |
|---|---|
| public default <K, V> MutableMap Overrides default org. Doc from org. Applies an aggregate function over the iterable grouping results into a map based on the specific groupBy function. Aggregate results are allowed to be immutable as they will be replaced in place in the map. A second function specifies the initial "zero" aggregate value to work with (i.e. Integer.valueOf(0)).
| |
| aggregateInPlaceBy | back to summary |
|---|---|
| public default <K, V> MutableMap Overrides default org. Doc from org. Applies an aggregate procedure over the iterable grouping results into a Map based on the specific groupBy function. Aggregate results are required to be mutable as they will be changed in place by the procedure. A second function specifies the initial "zero" aggregate value to work with (i.e. new AtomicInteger(0)).
| |
| asSynchronized | back to summary |
|---|---|
| public MutableStack | |
| asUnmodifiable | back to summary |
|---|---|
| public MutableStack | |
| clear | back to summary |
|---|---|
| public void clear() | |
| collect | back to summary |
|---|---|
| public <V> MutableStack Redeclares org. Doc from org. Returns a new collection with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map. Example using a Java 8 lambda expression:
RichIterable<String> names =
people.collect(person -> person.getFirstName() + " " + person.getLastName());
| |
| collectBoolean | back to summary |
|---|---|
| public MutableBooleanStack collectBoolean(BooleanFunction<? super T> booleanFunction) Redeclares org. Doc from org. Returns a new primitive Example using a Java 8 lambda expression:
BooleanIterable licenses =
people.collectBoolean(person -> person.hasDrivingLicense());
| |
| collectByte | back to summary |
|---|---|
| public MutableByteStack collectByte(ByteFunction<? super T> byteFunction) Redeclares org. Doc from org. Returns a new primitive Example using a Java 8 lambda expression:
ByteIterable bytes =
people.collectByte(person -> person.getCode());
| |
| collectChar | back to summary |
|---|---|
| public MutableCharStack collectChar(CharFunction<? super T> charFunction) Redeclares org. Doc from org. Returns a new primitive Example using a Java 8 lambda expression:
CharIterable chars =
people.collectChar(person -> person.getMiddleInitial());
| |
| collectDouble | back to summary |
|---|---|
| public MutableDoubleStack collectDouble(DoubleFunction<? super T> doubleFunction) Redeclares org. Doc from org. Returns a new primitive Example using a Java 8 lambda expression:
DoubleIterable doubles =
people.collectDouble(person -> person.getMilesFromNorthPole());
| |
| collectFloat | back to summary |
|---|---|
| public MutableFloatStack collectFloat(FloatFunction<? super T> floatFunction) Redeclares org. Doc from org. Returns a new primitive Example using a Java 8 lambda expression:
FloatIterable floats =
people.collectFloat(person -> person.getHeightInInches());
| |
| collectIf | back to summary |
|---|---|
| public <V> MutableStack Redeclares org. Doc from org. Returns a new collection with the results of applying the specified function on each element of the source collection, but only for those elements which return true upon evaluation of the predicate. This is the optimized equivalent of calling iterable.select(predicate).collect(function). Example using a Java 8 lambda and method reference: RichIterable<String> strings = Lists.mutable.with(1, 2, 3).collectIf(e -> e != null, Object::toString); Example using Predicates factory: RichIterable<String> strings = Lists.mutable.with(1, 2, 3).collectIf(Predicates.notNull(), Functions.getToString());
| |
| collectInt | back to summary |
|---|---|
| public MutableIntStack collectInt(IntFunction<? super T> intFunction) Redeclares org. Doc from org. Returns a new primitive Example using a Java 8 lambda expression:
IntIterable ints =
people.collectInt(person -> person.getAge());
| |
| collectLong | back to summary |
|---|---|
| public MutableLongStack collectLong(LongFunction<? super T> longFunction) Redeclares org. Doc from org. Returns a new primitive Example using a Java 8 lambda expression:
LongIterable longs =
people.collectLong(person -> person.getGuid());
| |
| collectShort | back to summary |
|---|---|
| public MutableShortStack collectShort(ShortFunction<? super T> shortFunction) Redeclares org. Doc from org. Returns a new primitive Example using a Java 8 lambda expression:
ShortIterable shorts =
people.collectShort(person -> person.getNumberOfJunkMailItemsReceivedPerMonth());
| |
| collectWith | back to summary |
|---|---|
| public <P, V> MutableStack Redeclares org. Doc from org. Same as Example using a Java 8 lambda expression:
RichIterable<Integer> integers =
Lists.mutable.with(1, 2, 3).collectWith((each, parameter) -> each + parameter, Integer.valueOf(1));
| |
| collectWithIndex | back to summary |
|---|---|
| public default <V> MutableStack Overrides default org. Doc from org. Returns a new OrderedIterable using results obtained by applying the specified function to each element and its corresponding index.
| |
| countBy | back to summary |
|---|---|
| public default <V> MutableBag Overrides default org. Doc from org. This method will count the number of occurrences of each value calculated by applying the function to each element of the collection.
| |
| countByEach | back to summary |
|---|---|
| public default <V> MutableBag Overrides default org. Doc from org. This method will count the number of occurrences of each value calculated by applying the function to each element of the collection.
| |
| countByWith | back to summary |
|---|---|
| public default <V, P> MutableBag Overrides default org. Doc from 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.
| |
| distinct | back to summary |
|---|---|
| public MutableStack Redeclares org. Doc from org. Returns a new
Conceptually similar to
| |
| dropWhile | back to summary |
|---|---|
| public MutableStack Redeclares org. Doc from org. Returns the final elements that do not satisfy the Predicate. Short circuits at the first element which does satisfy the Predicate.
| |
| flatCollect | back to summary |
|---|---|
| public <V> MutableStack Redeclares org. Doc from org.
Consider the following example where we have a Function<Person, List<Address>> addressFunction = Person::getAddresses; RichIterable<Person> people = ...;Using collect returns a collection of collections of addresses.
RichIterable<List<Address>> addresses = people.collect(addressFunction);Using flatCollect returns a single flattened list of addresses.
RichIterable<Address> addresses = people.flatCollect(addressFunction);
| |
| flatCollectWith | back to summary |
|---|---|
| public default <P, V> MutableStack Overrides default org. Doc from org. Same as flatCollect, only with a Function2 that is passed an extra parameter.
| |
| groupBy | back to summary |
|---|---|
| public <V> MutableListMultimap Redeclares org. Doc from 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. Example using a Java 8 method reference:
Multimap<String, Person> peopleByLastName =
people.groupBy(Person::getLastName);
| |
| groupByEach | back to summary |
|---|---|
| public <V> MutableListMultimap Redeclares org. Doc from org. Similar to
| |
| groupByUniqueKey | back to summary |
|---|---|
| public default <V> MutableMap Implements org. Doc from 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. The generated keys must each be unique, or else an exception is thrown.
| |
| partition | back to summary |
|---|---|
| public PartitionMutableStack Redeclares org. Doc from org. Filters a collection into a PartitionedIterable based on the evaluation of the predicate. Example using a Java 8 lambda expression:
PartitionIterable<Person> newYorkersAndNonNewYorkers =
people.partition(person -> person.getAddress().getState().getName().equals("New York"));
| |
| partitionWhile | back to summary |
|---|---|
| public PartitionMutableStack Redeclares org. Doc from org. Returns a Partition of the initial elements that satisfy the Predicate and the remaining elements. Short circuits at the first element which does satisfy the Predicate.
| |
| partitionWith | back to summary |
|---|---|
| public <P> PartitionMutableStack Redeclares org. Doc from org. Filters a collection into a PartitionIterable based on the evaluation of the predicate. Example using a Java 8 lambda expression:
PartitionIterable<Person> newYorkersAndNonNewYorkers =
people.partitionWith((Person person, String state) -> person.getAddress().getState().getName().equals(state), "New York");
| |
| pop | back to summary |
|---|---|
| public T pop() Removes and returns the top element of the stack. | |
| pop | back to summary |
|---|---|
| public ListIterable Removes and returns a ListIterable of the number of elements specified by the count, beginning with the top of the stack. | |
| pop | back to summary |
|---|---|
| public <R extends Collection Removes and returns a ListIterable of the number of elements specified by the count, beginning with the top of the stack and puts them into the targeted collection type. | |
| pop | back to summary |
|---|---|
| public <R extends MutableStack Removes and returns a ListIterable of the number of elements specified by the count, beginning with the top of the stack and puts them into a new stack. | |
| push | back to summary |
|---|---|
| public void push(T item) Adds an item to the top of the stack. | |
| reduceBy | back to summary |
|---|---|
| public default <K> MutableMap Overrides default org. Doc from org. Applies an aggregate function over the iterable grouping results into a map based on the specific groupBy function. Aggregate results are allowed to be immutable as they will be replaced in place in the map.
| |
| reject | back to summary |
|---|---|
| public MutableStack Redeclares org. Doc from org. Returns all elements of the source collection that return false when evaluating of the predicate. This method is also sometimes called filterNot and is the equivalent of calling iterable.select(Predicates.not(predicate)). Example using a Java 8 lambda expression:
RichIterable<Person> rejected =
people.reject(person -> person.person.getLastName().equals("Smith"));
| |
| rejectWith | back to summary |
|---|---|
| public <P> MutableStack Redeclares org. Doc from org. Similar to
E.g. return a Example using a Java 8 lambda expression:
RichIterable<Person> rejected =
people.rejectWith((Person person, Integer age) -> person.getAge() < age, Integer.valueOf(18));
| |
| select | back to summary |
|---|---|
| public MutableStack Redeclares org. Doc from org. Returns all elements of the source collection that return true when evaluating the predicate. This method is also commonly called filter. Example using a Java 8 lambda expression:
RichIterable<Person> selected =
people.select(person -> person.getAddress().getCity().equals("London"));
| |
| selectInstancesOf | back to summary |
|---|---|
| public <S> MutableStack Redeclares org. Doc from org. Returns all elements of the source collection that are instances of the Class
RichIterable<Integer> integers =
List.mutable.with(new Integer(0), new Long(0L), new Double(0.0)).selectInstancesOf(Integer.class);
| |
| selectWith | back to summary |
|---|---|
| public <P> MutableStack Redeclares org. Doc from org. Similar to
E.g. return a Example using a Java 8 lambda expression:
RichIterable<Person> selected =
people.selectWith((Person person, Integer age) -> person.getAge()>= age, Integer.valueOf(18));
| |
| sumByDouble | back to summary |
|---|---|
| public <V> MutableObjectDoubleMap Redeclares org. Doc from org. Groups and sums the values using the two specified functions.
| |
| sumByFloat | back to summary |
|---|---|
| public <V> MutableObjectDoubleMap Redeclares org. Doc from org. Groups and sums the values using the two specified functions.
| |
| sumByInt | back to summary |
|---|---|
| public <V> MutableObjectLongMap Redeclares org. Doc from org. Groups and sums the values using the two specified functions.
| |
| sumByLong | back to summary |
|---|---|
| public <V> MutableObjectLongMap Redeclares org. Doc from org. Groups and sums the values using the two specified functions.
| |
| takeWhile | back to summary |
|---|---|
| public MutableStack Redeclares org. Doc from org. Returns the initial elements that satisfy the Predicate. Short circuits at the first element which does not satisfy the Predicate.
| |
| tap | back to summary |
|---|---|
| public MutableStack Redeclares org. Doc from org. Executes the Procedure for each element in the iterable and returns Example using a Java 8 lambda expression:
RichIterable<Person> tapped =
people.tap(person -> LOGGER.info(person.getName()));
| |
| zip | back to summary |
|---|---|
| public <S> MutableStack Redeclares org. Doc from org. Returns a
| |
| zipWithIndex | back to summary |
|---|---|
| public MutableStack Redeclares org. Doc from org. Zips this
| |