| Modifier and Type | Method and Description |
|---|---|
| public <K2, V2> BiMap | collect(Function2<? super K, ? super V, Pair<K2, V2>> function)
Redeclares org. For each key and value of the map the function is evaluated. |
| public <R> BiMap | collectKeysUnique(Function2<? super K, ? super V, ? extends R> function)
Redeclares org. For each key and value of the map the function is evaluated. |
| public <R> BiMap | collectValues(Function2<? super K, ? super V, ? extends R> function)
Redeclares org. For each key and value of the map the function is evaluated. |
| public SetMultimap | flip()
Redeclares org. Given a map from Domain |
| public BiMap | flipUniqueValues()
Redeclares org. Return the MapIterable that is obtained by flipping the direction of this map and making the associations from value to key. |
| public <V1> SetMultimap | groupBy(Function<? super V, ? extends V1> 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 <V1> SetMultimap | groupByEach(Function<? super V, ? extends Iterable<V1>> function)
Redeclares org. Similar to |
| public <VV> BiMap | groupByUniqueKey(Function<? super V, ? extends VV> function)
Redeclares 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 BiMap | inverse()
Returns an inversed view of this BiMap, where the associations are in the direction of this bimap's values to keys. |
| public PartitionUnsortedSet | partition(Predicate<? super V> predicate)
Redeclares org. Filters a collection into a PartitionedIterable based on the evaluation of the predicate. |
| public <P> PartitionUnsortedSet | partitionWith(Predicate2<? super V, ? super P> predicate, P parameter)
Redeclares org. Filters a collection into a PartitionIterable based on the evaluation of the predicate. |
| public BiMap | reject(Predicate2<? super K, ? super V> predicate)
Redeclares org. For each key and value of the map the predicate is evaluated, if the result of the evaluation is false, that key and value are returned in a new map. |
| public SetIterable | reject(Predicate<? super V> predicate)
Redeclares org. Returns all elements of the source collection that return false when evaluating of the predicate. |
| public <P> SetIterable | rejectWith(Predicate2<? super V, ? super P> predicate, P parameter)
Redeclares org. Similar to |
| public BiMap | select(Predicate2<? super K, ? super V> predicate)
Redeclares org. For each key and value of the map the predicate is evaluated, if the result of the evaluation is true, that key and value are returned in a new map. |
| public SetIterable | select(Predicate<? super V> predicate)
Redeclares org. Returns all elements of the source collection that return true when evaluating the predicate. |
| public <S> SetIterable | selectInstancesOf(Class<S> clazz)
Redeclares org. Returns all elements of the source collection that are instances of the Class |
| public <P> SetIterable | selectWith(Predicate2<? super V, ? super P> predicate, P parameter)
Redeclares org. Similar to |
| public BiMap | tap(Procedure<? super V> procedure)
Redeclares org. Executes the Procedure for each value of the map and returns |
| public ImmutableBiMap | toImmutable()
Redeclares org. Converts the BiMap to an ImmutableBiMap. |
| public <S> SetIterable | zip(Iterable<S> that)
Redeclares org.
Deprecated
in 8.0. Use
OrderedIterable#zip(Iterable) instead.
Returns a |
| public SetIterable | zipWithIndex()
Redeclares org.
Deprecated
in 8.0. Use
OrderedIterable#zipWithIndex() instead.
Zips this |
| collect | back to summary |
|---|---|
| public <K2, V2> BiMap Redeclares org. Doc from org. For each key and value of the map the function is evaluated. The results of these evaluations are returned in a new map. The map returned will use the values projected from the function rather than the original values.
MapIterable<String, String> collected =
peopleByCity.collect((City city, Person person) -> Pair.of(city.getCountry(), person.getAddress().getCity()));
Implementations are expected to delegate to MutableBiMap#put(Object, Object),
ImmutableBiMap#newWithKeyValue(Object, Object), or equivalent, not MutableBiMap#forcePut(Object, Object).
| |
| collectKeysUnique | back to summary |
|---|---|
| public <R> BiMap Redeclares org. Doc from org. For each key and value of the map the function is evaluated. The results of these evaluations are returned in a new map. The map returned will use the keys projected from the function rather than the original keys.
| |
| collectValues | back to summary |
|---|---|
| public <R> BiMap Redeclares org. Doc from org. For each key and value of the map the function is evaluated. The results of these evaluations are returned in a new map. The map returned will use the values projected from the function rather than the original values.
MapIterable<City, String> collected =
peopleByCity.collectValues((City city, Person person) -> person.getFirstName() + " " + person.getLastName());
Implementations are expected to delegate to MutableBiMap#put(Object, Object),
ImmutableBiMap#newWithKeyValue(Object, Object), or equivalent, not MutableBiMap#forcePut(Object, Object).
| |
| flip | back to summary |
|---|---|
| public SetMultimap Redeclares org. Doc from org. Given a map from Domain Since the keys in the input are unique, the values in the output are unique, so the return type should be a SetMultimap. However, since SetMultimap and SortedSetMultimap don't inherit from one another, SetMultimap here does not allow SortedMapIterable to have a SortedSetMultimap return. Thus, we compromise and call this Multimap, even though all implementations will be a SetMultimap or SortedSetMultimap.
| |
| flipUniqueValues | back to summary |
|---|---|
| public BiMap Redeclares org. Doc from org. Return the MapIterable that is obtained by flipping the direction of this map and making the associations from value to key.
MapIterable<Integer, String> map = this.newMapWithKeysValues(1, "1", 2, "2", 3, "3");
MapIterable<String, Integer> result = map.flipUniqueValues();
Assert.assertTrue(result.equals(UnifiedMap.newWithKeysValues("1", 1, "2", 2, "3", 3)));
| |
| groupBy | back to summary |
|---|---|
| public <V1> SetMultimap 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 <V1> SetMultimap Redeclares org. Doc from org. Similar to
| |
| groupByUniqueKey | back to summary |
|---|---|
| public <VV> BiMap 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 map, where the transformed value is the key. The generated keys must each be unique, or else an exception is thrown.
| |
| inverse | back to summary |
|---|---|
| public BiMap Returns an inversed view of this BiMap, where the associations are in the direction of this bimap's values to keys. | |
| partition | back to summary |
|---|---|
| public PartitionUnsortedSet 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> PartitionUnsortedSet 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 BiMap Redeclares org. Doc from org. For each key and value of the map the predicate is evaluated, if the result of the evaluation is false, that key and value are returned in a new map.
MapIterable<City, Person> rejected =
peopleByCity.reject((city, person) -> city.getName().equals("Anytown") && person.getLastName().equals("Smith"));
| |
| reject | back to summary |
|---|---|
| public SetIterable 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> SetIterable 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 BiMap Redeclares org. Doc from org. For each key and value of the map the predicate is evaluated, if the result of the evaluation is true, that key and value are returned in a new map.
MapIterable<City, Person> selected =
peopleByCity.select((city, person) -> city.getName().equals("Anytown") && person.getLastName().equals("Smith"));
| |
| select | back to summary |
|---|---|
| public SetIterable 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> SetIterable 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> SetIterable 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 BiMap Redeclares org. Doc from org. Executes the Procedure for each value of the map and returns return peopleByCity.tap(person -> LOGGER.info(person.getName()));
| |
| toImmutable | back to summary |
|---|---|
| public ImmutableBiMap Redeclares org. Converts the BiMap to an ImmutableBiMap. If the bimap is immutable, it returns itself.
| |
| zip | back to summary |
|---|---|
| public <S> SetIterable Redeclares org. Doc from org. Deprecated in 8.0. Use Returns a
| |
| zipWithIndex | back to summary |
|---|---|
| public SetIterable Redeclares org. Doc from org. Deprecated in 8.0. Use Zips this
| |