Top Description Methods
org.eclipse.collections.api.bimap

public Interface MutableBiMap<K, V>

extends BiMap<K, V>, MutableMapIterable<K, V>, Cloneable
Imports
java.util.Map, org.eclipse.collections.api.block.function.Function, .Function0, .Function2, org.eclipse.collections.api.block.predicate.Predicate, .Predicate2, org.eclipse.collections.api.block.procedure.Procedure, org.eclipse.collections.api.factory.BiMaps, .Maps, org.eclipse.collections.api.map.MapIterable, .MutableMap, .MutableMapIterable, org.eclipse.collections.api.multimap.set.MutableSetMultimap, org.eclipse.collections.api.ordered.OrderedIterable, org.eclipse.collections.api.partition.set.PartitionMutableSet, org.eclipse.collections.api.set.MutableSet, org.eclipse.collections.api.tuple.Pair

A BiMap whose contents can be altered after initialization.
Since
4.2

Method Summary

Modifier and TypeMethod and Description
public default <KK, VV> MutableMap<KK, VV>
aggregateBy(Function<? super V, ? extends KK> groupBy, Function0<? extends VV> zeroValueFactory, Function2<? super VV, ? super V, ? extends VV> nonMutatingAggregator)

Overrides default org.eclipse.collections.api.RichIterable.aggregateBy, org.eclipse.collections.api.map.MutableMapIterable.aggregateBy.

Applies an aggregate function over the iterable grouping results into a map based on the specific groupBy function.

public default <K1, V1, V2> MutableMap<K1, V2>
aggregateBy(Function<? super K, ? extends K1> keyFunction, Function<? super V, ? extends V1> valueFunction, Function0<? extends V2> zeroValueFactory, Function2<? super V2, ? super V1, ? extends V2> nonMutatingAggregator)

Overrides default org.eclipse.collections.api.map.MapIterable.aggregateBy, org.eclipse.collections.api.map.MutableMapIterable.aggregateBy.

Applies an aggregate function over the map grouping results into a map based on the specific key and value groupBy functions.

public MutableBiMap<K, V>
asSynchronized()

Redeclares org.eclipse.collections.api.map.MutableMapIterable.asSynchronized.

Returns a synchronized wrapper backed by this map.

public MutableBiMap<K, V>
asUnmodifiable()

Redeclares org.eclipse.collections.api.map.MutableMapIterable.asUnmodifiable.

Returns an unmodifiable view of this map.

public MutableBiMap<K, V>
public <K2, V2> MutableBiMap<K2, V2>
collect(Function2<? super K, ? super V, Pair<K2, V2>> function)

Redeclares org.eclipse.collections.api.bimap.BiMap.collect, org.eclipse.collections.api.map.MutableMapIterable.collect.

For each key and value of the map the function is evaluated.

public <R> MutableBiMap<R, V>
collectKeysUnique(Function2<? super K, ? super V, ? extends R> function)

Redeclares org.eclipse.collections.api.bimap.BiMap.collectKeysUnique, org.eclipse.collections.api.map.MutableMapIterable.collectKeysUnique.

For each key and value of the map the function is evaluated.

public <R> MutableBiMap<K, R>
collectValues(Function2<? super K, ? super V, ? extends R> function)

Redeclares org.eclipse.collections.api.bimap.BiMap.collectValues, org.eclipse.collections.api.map.MutableMapIterable.collectValues.

For each key and value of the map the function is evaluated.

public MutableSetMultimap<V, K>
flip()

Redeclares org.eclipse.collections.api.bimap.BiMap.flip, org.eclipse.collections.api.map.MutableMapIterable.flip.

Given a map from Domain -> Range return a multimap from Range -> Domain.

public MutableBiMap<V, K>
flipUniqueValues()

Redeclares org.eclipse.collections.api.bimap.BiMap.flipUniqueValues, org.eclipse.collections.api.map.MutableMapIterable.flipUniqueValues.

Return the MapIterable that is obtained by flipping the direction of this map and making the associations from value to key.

public V
forcePut(K key, V value)

Similar to put(Object, Object), except that it quietly removes any existing entry with the same value before putting the key-value pair.

public <V1> MutableSetMultimap<V1, V>
groupBy(Function<? super V, ? extends V1> function)

Redeclares org.eclipse.collections.api.bimap.BiMap.groupBy, org.eclipse.collections.api.map.MutableMapIterable.groupBy.

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> MutableSetMultimap<V1, V>
groupByEach(Function<? super V, ? extends Iterable<V1>> function)

Redeclares org.eclipse.collections.api.bimap.BiMap.groupByEach, org.eclipse.collections.api.map.MutableMapIterable.groupByEach.

Similar to groupBy(Function), except the result of evaluating function will return a collection of keys for each value.

public default <VV> MutableBiMap<VV, V>
groupByUniqueKey(Function<? super V, ? extends VV> function)

Implements org.eclipse.collections.api.bimap.BiMap.groupByUniqueKey, org.eclipse.collections.api.map.MutableMapIterable.groupByUniqueKey.

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 MutableBiMap<V, K>
inverse()

Redeclares org.eclipse.collections.api.bimap.BiMap.inverse.

Returns an inversed view of this BiMap, where the associations are in the direction of this bimap's values to keys.

public MutableBiMap<K, V>
newEmpty()

Redeclares org.eclipse.collections.api.map.MutableMapIterable.newEmpty.

Creates a new instance of the same type, using the default capacity and growth parameters.

public PartitionMutableSet<V>
partition(Predicate<? super V> predicate)

Redeclares org.eclipse.collections.api.bimap.BiMap.partition, org.eclipse.collections.api.map.MutableMapIterable.partition.

Filters a collection into a PartitionedIterable based on the evaluation of the predicate.

public <P> PartitionMutableSet<V>
partitionWith(Predicate2<? super V, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.bimap.BiMap.partitionWith, org.eclipse.collections.api.RichIterable.partitionWith.

Filters a collection into a PartitionIterable based on the evaluation of the predicate.

public V
put(K key, V value)

Redeclares java.util.Map.put.

Similar to Map#put(Object, Object), except that it throws on the addition of a duplicate value.

public default <KK> MutableMap<KK, V>
reduceBy(Function<? super V, ? extends KK> groupBy, Function2<? super V, ? super V, ? extends V> reduceFunction)

Overrides default org.eclipse.collections.api.RichIterable.reduceBy, org.eclipse.collections.api.map.MutableMapIterable.reduceBy.

Applies an aggregate function over the iterable grouping results into a map based on the specific groupBy function.

public MutableBiMap<K, V>
reject(Predicate2<? super K, ? super V> predicate)

Redeclares org.eclipse.collections.api.bimap.BiMap.reject, org.eclipse.collections.api.map.MutableMapIterable.reject.

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 MutableSet<V>
reject(Predicate<? super V> predicate)

Redeclares org.eclipse.collections.api.bimap.BiMap.reject, org.eclipse.collections.api.map.MutableMapIterable.reject.

Returns all elements of the source collection that return false when evaluating of the predicate.

public <P> MutableSet<V>
rejectWith(Predicate2<? super V, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.bimap.BiMap.rejectWith, org.eclipse.collections.api.map.MutableMapIterable.rejectWith.

Similar to reject(Predicate), except with an evaluation parameter for the second generic argument in Predicate2.

public MutableBiMap<K, V>
select(Predicate2<? super K, ? super V> predicate)

Redeclares org.eclipse.collections.api.bimap.BiMap.select, org.eclipse.collections.api.map.MutableMapIterable.select.

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 MutableSet<V>
select(Predicate<? super V> predicate)

Redeclares org.eclipse.collections.api.bimap.BiMap.select, org.eclipse.collections.api.map.MutableMapIterable.select.

Returns all elements of the source collection that return true when evaluating the predicate.

public <S> MutableSet<S>
selectInstancesOf(Class<S> clazz)

Redeclares org.eclipse.collections.api.bimap.BiMap.selectInstancesOf, org.eclipse.collections.api.map.MutableMapIterable.selectInstancesOf.

Returns all elements of the source collection that are instances of the Class clazz.

public <P> MutableSet<V>
selectWith(Predicate2<? super V, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.bimap.BiMap.selectWith, org.eclipse.collections.api.map.MutableMapIterable.selectWith.

Similar to select(Predicate), except with an evaluation parameter for the second generic argument in Predicate2.

public MutableBiMap<K, V>
tap(Procedure<? super V> procedure)

Redeclares org.eclipse.collections.api.bimap.BiMap.tap, org.eclipse.collections.api.map.MutableMapIterable.tap.

Executes the Procedure for each value of the map and returns this.

public MutableBiMap<K, V>
withAllKeyValueArguments(Pair<? extends K, ? extends V>... keyValuePairs)

Redeclares org.eclipse.collections.api.map.MutableMapIterable.withAllKeyValueArguments.

Convenience var-args version of withAllKeyValues

public MutableBiMap<K, V>
withAllKeyValues(Iterable<? extends Pair<? extends K, ? extends V>> keyValues)

Redeclares org.eclipse.collections.api.map.MutableMapIterable.withAllKeyValues.

This method allows mutable, fixed size, and immutable maps the ability to add elements to their existing elements.

public MutableBiMap<K, V>
withKeyValue(K key, V value)

Redeclares org.eclipse.collections.api.map.MutableMapIterable.withKeyValue.

This method allows mutable, fixed size, and immutable maps the ability to add elements to their existing elements.

public default MutableBiMap<K, V>
withMap(Map<? extends K, ? extends V> map)

Overrides default org.eclipse.collections.api.map.MutableMapIterable.withMap.

Similar to putAll(Map), but returns this instead of void

public default MutableBiMap<K, V>
public MutableBiMap<K, V>
withoutAllKeys(Iterable<? extends K> keys)

Redeclares org.eclipse.collections.api.map.MutableMapIterable.withoutAllKeys.

This method allows mutable, fixed size, and immutable maps the ability to remove elements from their existing elements.

public MutableBiMap<K, V>
withoutKey(K key)

Redeclares org.eclipse.collections.api.map.MutableMapIterable.withoutKey.

This method allows mutable, fixed size, and immutable maps the ability to remove elements from their existing elements.

public <S> MutableSet<Pair<V, S>>
zip(Iterable<S> that)

Redeclares org.eclipse.collections.api.bimap.BiMap.zip, org.eclipse.collections.api.map.MutableMapIterable.zip.

Deprecated in 8.0. Use OrderedIterable#zip(Iterable) instead.

Returns a RichIterable formed from this RichIterable and another RichIterable by combining corresponding elements in pairs.

public MutableSet<Pair<V, Integer>>
Inherited from org.eclipse.collections.api.bimap.BiMap:
toImmutable
Inherited from org.eclipse.collections.api.map.MutableMapIterable:
addaggregateInPlaceBycountBycountByEachcountByWithforEachgetIfAbsentPutgetIfAbsentPutgetIfAbsentPutWithgetIfAbsentPutWithKeygetOrDefaultputAllMapIterableputPairremoveAllKeysremoveIfremoveKeysumByDoublesumByFloatsumByIntsumByLongtoImmutableupdateValueupdateValueWith

Method Detail

aggregateByback to summary
public default <KK, VV> MutableMap<KK, VV> aggregateBy(Function<? super V, ? extends KK> groupBy, Function0<? extends VV> zeroValueFactory, Function2<? super VV, ? super V, ? extends VV> nonMutatingAggregator)

Overrides default org.eclipse.collections.api.RichIterable.aggregateBy, org.eclipse.collections.api.map.MutableMapIterable.aggregateBy.

Doc from org.eclipse.collections.api.RichIterable.aggregateBy.

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)).

Annotations
@Override
Since
11.0
aggregateByback to summary
public default <K1, V1, V2> MutableMap<K1, V2> aggregateBy(Function<? super K, ? extends K1> keyFunction, Function<? super V, ? extends V1> valueFunction, Function0<? extends V2> zeroValueFactory, Function2<? super V2, ? super V1, ? extends V2> nonMutatingAggregator)

Overrides default org.eclipse.collections.api.map.MapIterable.aggregateBy, org.eclipse.collections.api.map.MutableMapIterable.aggregateBy.

Doc from org.eclipse.collections.api.map.MapIterable.aggregateBy.

Applies an aggregate function over the map grouping results into a map based on the specific key and value groupBy functions. 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.

MapIterable<String, Interval> map = Maps.mutable.with("oneToFive", Interval.fromTo(1, 5), "sixToNine", Interval.fromTo(6, 9));

MapIterable<String, Long> result = map.aggregateBy(
        eachKey -> {
            return eachKey.equals("oneToFive")  ? "lessThanSix" : "greaterOrEqualsToSix";
        },
        each -> each.sumOfInt(Integer::intValue),
        () -> 0L,
        (argument1, argument2) -> argument1 + argument2);

MapIterable<String, Long> expected =
        Maps.mutable.with("lessThanSix", Interval.fromTo(1, 5).sumOfInt(Integer::intValue),
                "greaterOrEqualsToSix", Interval.fromTo(6, 9).sumOfInt(Integer::intValue));
Assert.assertEquals(expected, result);
Annotations
@Override
Since
11.0
asSynchronizedback to summary
public MutableBiMap<K, V> asSynchronized()

Redeclares org.eclipse.collections.api.map.MutableMapIterable.asSynchronized.

Doc from org.eclipse.collections.api.map.MutableMapIterable.asSynchronized.

Returns a synchronized wrapper backed by this map. This is the equivalent of calling Collections.synchronizedMap(this) only with the more feature rich return type of MutableMapIterable.

The preferred way of iterating over a synchronized map is to use the forEachKey(), forEachValue() and forEachKeyValue() methods which are properly synchronized internally.

 MutableMap synchedMap = map.asSynchronized();

 synchedMap.forEachKey(key -> ... );
 synchedMap.forEachValue(value -> ... );
 synchedMap.forEachKeyValue((key, value) -> ... );

If you want to iterate imperatively over the keySet(), values(), or entrySet(), you will need to protect the iteration by wrapping the code in a synchronized block on the map.

Annotations
@Override
asUnmodifiableback to summary
public MutableBiMap<K, V> asUnmodifiable()

Redeclares org.eclipse.collections.api.map.MutableMapIterable.asUnmodifiable.

Doc from org.eclipse.collections.api.map.MutableMapIterable.asUnmodifiable.

Returns an unmodifiable view of this map. This is the equivalent of using Collections.unmodifiableMap(this) only with a return type that supports the full iteration protocols available on MutableMapIterable. Methods which would mutate the underlying map will throw UnsupportedOperationExceptions.

Annotations
@Override
cloneback to summary
public MutableBiMap<K, V> clone()
collectback to summary
public <K2, V2> MutableBiMap<K2, V2> collect(Function2<? super K, ? super V, Pair<K2, V2>> function)

Redeclares org.eclipse.collections.api.bimap.BiMap.collect, org.eclipse.collections.api.map.MutableMapIterable.collect.

Doc from org.eclipse.collections.api.bimap.BiMap.collect.

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).
Annotations
@Override
collectKeysUniqueback to summary
public <R> MutableBiMap<R, V> collectKeysUnique(Function2<? super K, ? super V, ? extends R> function)

Redeclares org.eclipse.collections.api.bimap.BiMap.collectKeysUnique, org.eclipse.collections.api.map.MutableMapIterable.collectKeysUnique.

Doc from org.eclipse.collections.api.map.MapIterable.collectKeysUnique.

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.

Annotations
@Override
collectValuesback to summary
public <R> MutableBiMap<K, R> collectValues(Function2<? super K, ? super V, ? extends R> function)

Redeclares org.eclipse.collections.api.bimap.BiMap.collectValues, org.eclipse.collections.api.map.MutableMapIterable.collectValues.

Doc from org.eclipse.collections.api.bimap.BiMap.collectValues.

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).
Annotations
@Override
flipback to summary
public MutableSetMultimap<V, K> flip()

Redeclares org.eclipse.collections.api.bimap.BiMap.flip, org.eclipse.collections.api.map.MutableMapIterable.flip.

Doc from org.eclipse.collections.api.map.MapIterable.flip.

Given a map from Domain -> Range return a multimap from Range -> Domain. We chose the name 'flip' rather than 'invert' or 'transpose' since this method does not have the property of applying twice returns the original.

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.

Annotations
@Override
flipUniqueValuesback to summary
public MutableBiMap<V, K> flipUniqueValues()

Redeclares org.eclipse.collections.api.bimap.BiMap.flipUniqueValues, org.eclipse.collections.api.map.MutableMapIterable.flipUniqueValues.

Doc from org.eclipse.collections.api.map.MapIterable.flipUniqueValues.

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)));
Annotations
@Override
forcePutback to summary
public V forcePut(K key, V value)

Similar to put(Object, Object), except that it quietly removes any existing entry with the same value before putting the key-value pair.

groupByback to summary
public <V1> MutableSetMultimap<V1, V> groupBy(Function<? super V, ? extends V1> function)

Redeclares org.eclipse.collections.api.bimap.BiMap.groupBy, org.eclipse.collections.api.map.MutableMapIterable.groupBy.

Doc from org.eclipse.collections.api.RichIterable.groupBy.

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);
Annotations
@Override
groupByEachback to summary
public <V1> MutableSetMultimap<V1, V> groupByEach(Function<? super V, ? extends Iterable<V1>> function)

Redeclares org.eclipse.collections.api.bimap.BiMap.groupByEach, org.eclipse.collections.api.map.MutableMapIterable.groupByEach.

Doc from org.eclipse.collections.api.RichIterable.groupByEach.

Similar to groupBy(Function), except the result of evaluating function will return a collection of keys for each value.

Annotations
@Override
groupByUniqueKeyback to summary
public default <VV> MutableBiMap<VV, V> groupByUniqueKey(Function<? super V, ? extends VV> function)

Implements org.eclipse.collections.api.bimap.BiMap.groupByUniqueKey, org.eclipse.collections.api.map.MutableMapIterable.groupByUniqueKey.

Doc from org.eclipse.collections.api.RichIterable.groupByUniqueKey.

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.

Annotations
@Override
inverseback to summary
public MutableBiMap<V, K> inverse()

Redeclares org.eclipse.collections.api.bimap.BiMap.inverse.

Doc from org.eclipse.collections.api.bimap.BiMap.inverse.

Returns an inversed view of this BiMap, where the associations are in the direction of this bimap's values to keys.

Annotations
@Override
newEmptyback to summary
public MutableBiMap<K, V> newEmpty()

Redeclares org.eclipse.collections.api.map.MutableMapIterable.newEmpty.

Doc from org.eclipse.collections.api.map.MutableMapIterable.newEmpty.

Creates a new instance of the same type, using the default capacity and growth parameters.

Annotations
@Override
partitionback to summary
public PartitionMutableSet<V> partition(Predicate<? super V> predicate)

Redeclares org.eclipse.collections.api.bimap.BiMap.partition, org.eclipse.collections.api.map.MutableMapIterable.partition.

Doc from org.eclipse.collections.api.RichIterable.partition.

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"));
Annotations
@Override
partitionWithback to summary
public <P> PartitionMutableSet<V> partitionWith(Predicate2<? super V, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.bimap.BiMap.partitionWith, org.eclipse.collections.api.RichIterable.partitionWith.

Doc from org.eclipse.collections.api.RichIterable.partitionWith.

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");
Annotations
@Override
putback to summary
public V put(K key, V value)

Redeclares java.util.Map.put.

Similar to Map#put(Object, Object), except that it throws on the addition of a duplicate value.

Annotations
@Override
Exceptions
IllegalArgumentException:
if the value already exists in the bimap.
reduceByback to summary
public default <KK> MutableMap<KK, V> reduceBy(Function<? super V, ? extends KK> groupBy, Function2<? super V, ? super V, ? extends V> reduceFunction)

Overrides default org.eclipse.collections.api.RichIterable.reduceBy, org.eclipse.collections.api.map.MutableMapIterable.reduceBy.

Doc from org.eclipse.collections.api.RichIterable.reduceBy.

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.

Annotations
@Override
rejectback to summary
public MutableBiMap<K, V> reject(Predicate2<? super K, ? super V> predicate)

Redeclares org.eclipse.collections.api.bimap.BiMap.reject, org.eclipse.collections.api.map.MutableMapIterable.reject.

Doc from org.eclipse.collections.api.map.MapIterable.reject.

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"));
Annotations
@Override
rejectback to summary
public MutableSet<V> reject(Predicate<? super V> predicate)

Redeclares org.eclipse.collections.api.bimap.BiMap.reject, org.eclipse.collections.api.map.MutableMapIterable.reject.

Doc from org.eclipse.collections.api.RichIterable.reject.

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"));
Annotations
@Override
rejectWithback to summary
public <P> MutableSet<V> rejectWith(Predicate2<? super V, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.bimap.BiMap.rejectWith, org.eclipse.collections.api.map.MutableMapIterable.rejectWith.

Doc from org.eclipse.collections.api.RichIterable.rejectWith.

Similar to reject(Predicate), except with an evaluation parameter for the second generic argument in Predicate2.

E.g. return a Collection of Person elements where the person has an age greater than or equal to 18 years

Example using a Java 8 lambda expression:

RichIterable<Person> rejected =
    people.rejectWith((Person person, Integer age) -> person.getAge() < age, Integer.valueOf(18));
Annotations
@Override
selectback to summary
public MutableBiMap<K, V> select(Predicate2<? super K, ? super V> predicate)

Redeclares org.eclipse.collections.api.bimap.BiMap.select, org.eclipse.collections.api.map.MutableMapIterable.select.

Doc from org.eclipse.collections.api.map.MapIterable.select.

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"));
Annotations
@Override
selectback to summary
public MutableSet<V> select(Predicate<? super V> predicate)

Redeclares org.eclipse.collections.api.bimap.BiMap.select, org.eclipse.collections.api.map.MutableMapIterable.select.

Doc from org.eclipse.collections.api.RichIterable.select.

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"));
Annotations
@Override
selectInstancesOfback to summary
public <S> MutableSet<S> selectInstancesOf(Class<S> clazz)

Redeclares org.eclipse.collections.api.bimap.BiMap.selectInstancesOf, org.eclipse.collections.api.map.MutableMapIterable.selectInstancesOf.

Doc from org.eclipse.collections.api.RichIterable.selectInstancesOf.

Returns all elements of the source collection that are instances of the Class clazz.

RichIterable<Integer> integers =
    List.mutable.with(new Integer(0), new Long(0L), new Double(0.0)).selectInstancesOf(Integer.class);
Annotations
@Override
selectWithback to summary
public <P> MutableSet<V> selectWith(Predicate2<? super V, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.bimap.BiMap.selectWith, org.eclipse.collections.api.map.MutableMapIterable.selectWith.

Doc from org.eclipse.collections.api.RichIterable.selectWith.

Similar to select(Predicate), except with an evaluation parameter for the second generic argument in Predicate2.

E.g. return a Collection of Person elements where the person has an age greater than or equal to 18 years

Example using a Java 8 lambda expression:

RichIterable<Person> selected =
    people.selectWith((Person person, Integer age) -> person.getAge()>= age, Integer.valueOf(18));
Annotations
@Override
tapback to summary
public MutableBiMap<K, V> tap(Procedure<? super V> procedure)

Redeclares org.eclipse.collections.api.bimap.BiMap.tap, org.eclipse.collections.api.map.MutableMapIterable.tap.

Doc from org.eclipse.collections.api.map.MapIterable.tap.

Executes the Procedure for each value of the map and returns this.

return peopleByCity.tap(person -> LOGGER.info(person.getName()));
Annotations
@Override
withAllKeyValueArgumentsback to summary
public MutableBiMap<K, V> withAllKeyValueArguments(Pair<? extends K, ? extends V>... keyValuePairs)

Redeclares org.eclipse.collections.api.map.MutableMapIterable.withAllKeyValueArguments.

Doc from org.eclipse.collections.api.map.MutableMapIterable.withAllKeyValueArguments.

Convenience var-args version of withAllKeyValues

Annotations
@Override
withAllKeyValuesback to summary
public MutableBiMap<K, V> withAllKeyValues(Iterable<? extends Pair<? extends K, ? extends V>> keyValues)

Redeclares org.eclipse.collections.api.map.MutableMapIterable.withAllKeyValues.

Doc from org.eclipse.collections.api.map.MutableMapIterable.withAllKeyValues.

This method allows mutable, fixed size, and immutable maps the ability to add elements to their existing elements. In order to support fixed size maps, a new instance of a map would have to be returned including the keys and values of the original plus all the additional keys and values. In the case of mutable maps, the original map is modified and then returned. In order to use this method properly with mutable and fixed size maps the following approach must be taken:

map = map.withAllKeyValues(FastList.newListWith(PairImpl.of("new key", "new value")));
In the case of FixedSizeMap, a new instance will be returned by withAllKeyValues, and any variables that previously referenced the original map will need to be redirected to reference the new instance. In the case of a FastMap or UnifiedMap, you will be replacing the reference to map with map, since FastMap and UnifiedMap will both return "this" after calling put on themselves.
Annotations
@Override
withKeyValueback to summary
public MutableBiMap<K, V> withKeyValue(K key, V value)

Redeclares org.eclipse.collections.api.map.MutableMapIterable.withKeyValue.

Doc from org.eclipse.collections.api.map.MutableMapIterable.withKeyValue.

This method allows mutable, fixed size, and immutable maps the ability to add elements to their existing elements. In order to support fixed size maps, a new instance of a map would have to be returned including the keys and values of the original plus the additional key and value. In the case of mutable maps, the original map is modified and then returned. In order to use this method properly with mutable and fixed size maps the following approach must be taken:

map = map.withKeyValue("new key", "new value");
In the case of FixedSizeMap, a new instance will be returned by withKeyValue, and any variables that previously referenced the original map will need to be redirected to reference the new instance. In the case of a FastMap or UnifiedMap, you will be replacing the reference to map with map, since FastMap and UnifiedMap will both return "this" after calling put on themselves.
Annotations
@Override
withMapback to summary
public default MutableBiMap<K, V> withMap(Map<? extends K, ? extends V> map)

Overrides default org.eclipse.collections.api.map.MutableMapIterable.withMap.

Doc from org.eclipse.collections.api.map.MutableMapIterable.withMap.

Similar to putAll(Map), but returns this instead of void

Annotations
@Override
withMapIterableback to summary
public default MutableBiMap<K, V> withMapIterable(MapIterable<? extends K, ? extends V> mapIterable)

Overrides default org.eclipse.collections.api.map.MutableMapIterable.withMapIterable.

Annotations
@Override
withoutAllKeysback to summary
public MutableBiMap<K, V> withoutAllKeys(Iterable<? extends K> keys)

Redeclares org.eclipse.collections.api.map.MutableMapIterable.withoutAllKeys.

Doc from org.eclipse.collections.api.map.MutableMapIterable.withoutAllKeys.

This method allows mutable, fixed size, and immutable maps the ability to remove elements from their existing elements. In order to support fixed size maps, a new instance of a map would have to be returned including the keys and values of the original minus all the keys and values to be removed. In the case of mutable maps, the original map is modified and then returned. In order to use this method properly with mutable and fixed size maps the following approach must be taken:

map = map.withoutAllKeys(FastList.newListWith("key1", "key2"));
In the case of FixedSizeMap, a new instance will be returned by withoutAllKeys, and any variables that previously referenced the original map will need to be redirected to reference the new instance. In the case of a FastMap or UnifiedMap, you will be replacing the reference to map with map, since FastMap and UnifiedMap will both return "this" after calling remove on themselves.
Annotations
@Override
withoutKeyback to summary
public MutableBiMap<K, V> withoutKey(K key)

Redeclares org.eclipse.collections.api.map.MutableMapIterable.withoutKey.

Doc from org.eclipse.collections.api.map.MutableMapIterable.withoutKey.

This method allows mutable, fixed size, and immutable maps the ability to remove elements from their existing elements. In order to support fixed size maps, a new instance of a map would have to be returned including the keys and values of the original minus the key and value to be removed. In the case of mutable maps, the original map is modified and then returned. In order to use this method properly with mutable and fixed size maps the following approach must be taken:

map = map.withoutKey("key");
In the case of FixedSizeMap, a new instance will be returned by withoutKey, and any variables that previously referenced the original map will need to be redirected to reference the new instance. In the case of a FastMap or UnifiedMap, you will be replacing the reference to map with map, since FastMap and UnifiedMap will both return "this" after calling remove on themselves.
Annotations
@Override
zipback to summary
public <S> MutableSet<Pair<V, S>> zip(Iterable<S> that)

Redeclares org.eclipse.collections.api.bimap.BiMap.zip, org.eclipse.collections.api.map.MutableMapIterable.zip.

Doc from org.eclipse.collections.api.RichIterable.zip.

Deprecated

in 8.0. Use OrderedIterable#zip(Iterable) instead.

Returns a RichIterable formed from this RichIterable and another RichIterable by combining corresponding elements in pairs. If one of the two RichIterables is longer than the other, its remaining elements are ignored.

Annotations
@Override
@Deprecated
zipWithIndexback to summary
public MutableSet<Pair<V, Integer>> zipWithIndex()

Redeclares org.eclipse.collections.api.bimap.BiMap.zipWithIndex, org.eclipse.collections.api.map.MutableMapIterable.zipWithIndex.

Doc from org.eclipse.collections.api.RichIterable.zipWithIndex.

Deprecated

in 8.0. Use OrderedIterable#zipWithIndex() instead.

Zips this RichIterable with its indices.

Annotations
@Override
@Deprecated