| Modifier and Type | Method and Description |
|---|---|
| public <V> ImmutableCollection | collectWithOccurrences(ObjectIntToObjectFunction<? super T, ? extends V> function)
Redeclares org. Iterates over the unique elements and their occurrences and collects the results of applying the specified function. |
| public <V> ImmutableBagIterableMultimap | 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> ImmutableBagIterableMultimap | groupByEach(Function<? super T, ? extends Iterable<V>> function)
Redeclares org. Similar to |
| public PartitionImmutableBagIterable | partition(Predicate<? super T> predicate)
Redeclares org. Filters a collection into a PartitionedIterable based on the evaluation of the predicate. |
| public <P> PartitionImmutableBagIterable | 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 ImmutableBagIterable | reject(Predicate<? super T> predicate)
Redeclares org. Returns all elements of the source collection that return false when evaluating of the predicate. |
| public <P> ImmutableBagIterable | rejectWith(Predicate2<? super T, ? super P> predicate, P parameter)
Redeclares org. Similar to |
| public ImmutableBagIterable | select(Predicate<? super T> predicate)
Redeclares org. Returns all elements of the source collection that return true when evaluating the predicate. |
| public ImmutableBagIterable | selectByOccurrences(IntPredicate predicate)
Redeclares org. Returns all elements of the bag that have a number of occurrences that satisfy the predicate. |
| public default ImmutableBagIterable | selectDuplicates()
Overrides default org. Returns all elements of the bag that have more than one occurrence. |
| public <S> ImmutableBagIterable | selectInstancesOf(Class<S> clazz)
Redeclares org. Returns all elements of the source collection that are instances of the Class |
| public ImmutableSetIterable | selectUnique()
Redeclares org. Returns a set containing all elements of the bag that have exactly one occurrence. |
| public <P> ImmutableBagIterable | selectWith(Predicate2<? super T, ? super P> predicate, P parameter)
Redeclares org. Similar to |
| public ImmutableBagIterable | tap(Procedure<? super T> procedure)
Redeclares org. Executes the Procedure for each element in the iterable and returns |
| public MutableMapIterable | toMapOfItemToCount()
Redeclares org. Converts the Bag to a Map of the Item type to its count as an Integer. |
| public ImmutableSetIterable | zipWithIndex()
Redeclares org. Zips this |
| collectWithOccurrences | back to summary |
|---|---|
| public <V> ImmutableCollection Redeclares org. Doc from org. Iterates over the unique elements and their occurrences and collects the results of applying the specified function.
| |
| groupBy | back to summary |
|---|---|
| public <V> ImmutableBagIterableMultimap 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> ImmutableBagIterableMultimap Redeclares org. Doc from org. Similar to
| |
| partition | back to summary |
|---|---|
| public PartitionImmutableBagIterable 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"));
| |
| partitionWith | back to summary |
|---|---|
| public <P> PartitionImmutableBagIterable 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");
| |
| reject | back to summary |
|---|---|
| public ImmutableBagIterable 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> ImmutableBagIterable 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 ImmutableBagIterable 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"));
| |
| selectByOccurrences | back to summary |
|---|---|
| public ImmutableBagIterable Redeclares org. Doc from org. Returns all elements of the bag that have a number of occurrences that satisfy the predicate.
| |
| selectDuplicates | back to summary |
|---|---|
| public default ImmutableBagIterable Overrides default org. Doc from org. Returns all elements of the bag that have more than one occurrence.
| |
| selectInstancesOf | back to summary |
|---|---|
| public <S> ImmutableBagIterable 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);
| |
| selectUnique | back to summary |
|---|---|
| public ImmutableSetIterable Redeclares org. Doc from org. Returns a set containing all elements of the bag that have exactly one occurrence.
| |
| selectWith | back to summary |
|---|---|
| public <P> ImmutableBagIterable 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));
| |
| tap | back to summary |
|---|---|
| public ImmutableBagIterable 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()));
| |
| toMapOfItemToCount | back to summary |
|---|---|
| public MutableMapIterable Redeclares org. Doc from org. Converts the Bag to a Map of the Item type to its count as an Integer.
| |
| zipWithIndex | back to summary |
|---|---|
| public ImmutableSetIterable Redeclares org. Doc from org. Zips this
| |