java.lang.Iterable<K>
, java.util.Map<K,V>
, InternalIterable<K>
, MapIterable<K,V>
, MutableMapIterable<K,V>
, RichIterable<K>
SynchronizedBiMap
, SynchronizedMutableMap
, SynchronizedSortedMap
public abstract class AbstractSynchronizedMapIterable<K,V> extends AbstractSynchronizedRichIterable<V> implements MutableMapIterable<K,V>
Modifier and Type | Method | Description |
---|---|---|
V |
add(Pair<K,V> keyValuePair) |
This method allows mutable map the ability to add an element in the form of Pair
|
<KK,VV> MutableMap<KK,VV> |
aggregateBy(Function<? super V,? extends KK> groupBy,
Function0<? extends VV> zeroValueFactory,
Function2<? super VV,? super V,? extends VV> nonMutatingAggregator) |
Applies an aggregate function over the iterable grouping results into a map based on the specific groupBy function.
|
<KK,VV> MutableMap<KK,VV> |
aggregateInPlaceBy(Function<? super V,? extends KK> groupBy,
Function0<? extends VV> zeroValueFactory,
Procedure2<? super VV,? super V> mutatingAggregator) |
Applies an aggregate procedure over the iterable grouping results into a Map based on the specific groupBy function.
|
void |
clear() |
|
boolean |
containsKey(java.lang.Object key) |
|
boolean |
containsValue(java.lang.Object value) |
|
<V1> MutableBag<V1> |
countBy(Function<? super V,? extends V1> function) |
This method will count the number of occurrences of each value calculated by applying the
function to each element of the collection.
|
<V1,P> MutableBag<V1> |
countByWith(Function2<? super V,? super P,? extends V1> function,
P parameter) |
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.
|
Pair<K,V> |
detect(Predicate2<? super K,? super V> predicate) |
Return the first key and value of the map for which the predicate evaluates to true when they are given
as arguments.
|
java.util.Optional<Pair<K,V>> |
detectOptional(Predicate2<? super K,? super V> predicate) |
Return the first key and value of the map as an Optional for which the predicate evaluates to true when
they are given as arguments.
|
void |
forEachKey(Procedure<? super K> procedure) |
Calls the
procedure with each key of the map. |
void |
forEachKeyValue(Procedure2<? super K,? super V> procedure2) |
Calls the
procedure with each key-value pair of the map. |
void |
forEachValue(Procedure<? super V> procedure) |
Calls the procedure with each value of the map.
|
V |
get(java.lang.Object key) |
|
V |
getIfAbsent(K key,
Function0<? extends V> function) |
Return the value in the Map that corresponds to the specified key, or if there is no value at the key, return the
result of evaluating the specified Function0.
|
V |
getIfAbsentPut(K key,
Function0<? extends V> function) |
Get and return the value in the Map at the specified key.
|
V |
getIfAbsentPut(K key,
V value) |
Get and return the value in the Map at the specified key.
|
<P> V |
getIfAbsentPutWith(K key,
Function<? super P,? extends V> function,
P parameter) |
Get and return the value in the Map at the specified key.
|
V |
getIfAbsentPutWithKey(K key,
Function<? super K,? extends V> function) |
Get and return the value in the Map at the specified key.
|
V |
getIfAbsentValue(K key,
V value) |
Return the value in the Map that corresponds to the specified key, or if there is no value at the key, return
value . |
<P> V |
getIfAbsentWith(K key,
Function<? super P,? extends V> function,
P parameter) |
Return the value in the Map that corresponds to the specified key, or if there is no value at the key, return the
result of evaluating the specified function and parameter.
|
<V1> MutableMultimap<V1,V> |
groupBy(Function<? super V,? extends V1> function) |
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.
|
<V1> MutableMultimap<V1,V> |
groupByEach(Function<? super V,? extends java.lang.Iterable<V1>> function) |
Similar to
RichIterable.groupBy(Function) , except the result of evaluating function will return a collection of keys
for each value. |
<VV> MutableMapIterable<VV,V> |
groupByUniqueKey(Function<? super V,? extends VV> function) |
For each element of the iterable, the function is evaluated and he results of these evaluations are collected
into a new map, where the transformed value is the key.
|
<A> A |
ifPresentApply(K key,
Function<? super V,? extends A> function) |
If there is a value in the Map that corresponds to the specified key return the result of applying the specified
Function on the value, otherwise return null.
|
RichIterable<Pair<K,V>> |
keyValuesView() |
Returns an unmodifiable lazy iterable of key/value pairs wrapped around the entrySet for the map.
|
PartitionMutableCollection<V> |
partition(Predicate<? super V> predicate) |
Filters a collection into a PartitionedIterable based on the evaluation of the predicate.
|
V |
put(K key,
V value) |
|
void |
putAll(java.util.Map<? extends K,? extends V> map) |
|
MutableCollection<V> |
reject(Predicate<? super V> predicate) |
Returns all elements of the source collection that return false when evaluating of the predicate.
|
<P> MutableCollection<V> |
rejectWith(Predicate2<? super V,? super P> predicate,
P parameter) |
Similar to
RichIterable.reject(Predicate) , except with an evaluation parameter for the second generic argument in Predicate2 . |
V |
remove(java.lang.Object key) |
|
V |
removeKey(K key) |
Remove an entry from the map at the specified
key . |
MutableCollection<V> |
select(Predicate<? super V> predicate) |
Returns all elements of the source collection that return true when evaluating the predicate.
|
<S> MutableCollection<S> |
selectInstancesOf(java.lang.Class<S> clazz) |
Returns all elements of the source collection that are instances of the Class
clazz . |
<P> MutableCollection<V> |
selectWith(Predicate2<? super V,? super P> predicate,
P parameter) |
Similar to
RichIterable.select(Predicate) , except with an evaluation parameter for the second generic argument in Predicate2 . |
<V1> MutableObjectDoubleMap<V1> |
sumByDouble(Function<? super V,? extends V1> groupBy,
DoubleFunction<? super V> function) |
Groups and sums the values using the two specified functions.
|
<V1> MutableObjectDoubleMap<V1> |
sumByFloat(Function<? super V,? extends V1> groupBy,
FloatFunction<? super V> function) |
Groups and sums the values using the two specified functions.
|
<V1> MutableObjectLongMap<V1> |
sumByInt(Function<? super V,? extends V1> groupBy,
IntFunction<? super V> function) |
Groups and sums the values using the two specified functions.
|
<V1> MutableObjectLongMap<V1> |
sumByLong(Function<? super V,? extends V1> groupBy,
LongFunction<? super V> function) |
Groups and sums the values using the two specified functions.
|
MutableMapIterable<K,V> |
tap(Procedure<? super V> procedure) |
Executes the Procedure for each element in the iterable and returns
this . |
V |
updateValue(K key,
Function0<? extends V> factory,
Function<? super V,? extends V> function) |
Looks up the value associated with
key , applies the function to it, and replaces the value. |
<P> V |
updateValueWith(K key,
Function0<? extends V> factory,
Function2<? super V,? super P,? extends V> function,
P parameter) |
Same as
MutableMapIterable.updateValue(Object, Function0, Function) with a Function2 and specified parameter which is
passed to the function. |
<S> MutableCollection<Pair<V,S>> |
zip(java.lang.Iterable<S> that) |
Returns a
RichIterable formed from this RichIterable and another RichIterable by
combining corresponding elements in pairs. |
MutableCollection<Pair<V,java.lang.Integer>> |
zipWithIndex() |
Zips this
RichIterable with its indices. |
allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, asLazy, chunk, collect, collect, collectBoolean, collectBoolean, collectByte, collectByte, collectChar, collectChar, collectDouble, collectDouble, collectFloat, collectFloat, collectIf, collectIf, collectInt, collectInt, collectLong, collectLong, collectShort, collectShort, collectWith, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, count, countBy, countByWith, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, equals, flatCollect, flatCollect, forEach, forEachWith, forEachWithIndex, getFirst, getLast, getOnly, groupBy, groupByEach, groupByUniqueKey, hashCode, injectInto, injectInto, injectInto, injectInto, injectInto, into, isEmpty, iterator, makeString, makeString, makeString, max, max, maxBy, maxByOptional, maxOptional, maxOptional, min, min, minBy, minByOptional, minOptional, minOptional, noneSatisfy, noneSatisfyWith, notEmpty, partitionWith, reject, rejectWith, select, selectWith, size, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toList, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toSortedSetBy, toString, zip, zipWithIndex
forEach, forEach, forEachWith, forEachWithIndex
compute, computeIfAbsent, computeIfPresent, entry, entrySet, equals, forEach, getOrDefault, hashCode, isEmpty, keySet, merge, of, of, of, of, of, of, of, of, of, of, of, ofEntries, putIfAbsent, remove, replace, replace, replaceAll, size, values
equals, hashCode, keysView, parallelStream, spliterator, stream, toString, valuesView
asSynchronized, asUnmodifiable, collect, collectValues, flip, flipUniqueValues, newEmpty, reject, select, toImmutable, withAllKeyValueArguments, withAllKeyValues, withKeyValue, withoutAllKeys, withoutKey
getClass, hashCode, notify, notifyAll, wait, wait, wait
allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, asLazy, chunk, collect, collect, collectBoolean, collectBoolean, collectByte, collectByte, collectChar, collectChar, collectDouble, collectDouble, collectFloat, collectFloat, collectIf, collectIf, collectInt, collectInt, collectLong, collectLong, collectShort, collectShort, collectWith, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, count, countBy, countByWith, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, flatCollect, flatCollect, getFirst, getLast, getOnly, groupBy, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, into, isEmpty, makeString, makeString, makeString, max, max, maxBy, maxByOptional, maxOptional, maxOptional, min, min, minBy, minByOptional, minOptional, minOptional, noneSatisfy, noneSatisfyWith, notEmpty, partitionWith, reduce, reduceInPlace, reduceInPlace, reject, rejectWith, select, selectWith, size, summarizeDouble, summarizeFloat, summarizeInt, summarizeLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toList, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toSortedSetBy, zip, zipWithIndex
public V get(java.lang.Object key)
public V getIfAbsent(K key, Function0<? extends V> function)
MapIterable
getIfAbsent
in interface MapIterable<K,V>
public V getIfAbsentValue(K key, V value)
MapIterable
value
.getIfAbsentValue
in interface MapIterable<K,V>
public <P> V getIfAbsentWith(K key, Function<? super P,? extends V> function, P parameter)
MapIterable
getIfAbsentWith
in interface MapIterable<K,V>
public <A> A ifPresentApply(K key, Function<? super V,? extends A> function)
MapIterable
ifPresentApply
in interface MapIterable<K,V>
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<K,V>
containsKey
in interface MapIterable<K,V>
Map.containsKey(Object)
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map<K,V>
containsValue
in interface MapIterable<K,V>
Map.containsValue(Object)
public void forEachValue(Procedure<? super V> procedure)
MapIterable
Set<String> result = UnifiedSet.newSet(); MutableMap<Integer, String> map = this.newMapWithKeysValues(1, "One", 2, "Two", 3, "Three", 4, "Four"); map.forEachValue(new CollectionAddProcedure<String>(result)); Verify.assertSetsEqual(UnifiedSet.newSetWith("One", "Two", "Three", "Four"), result);
forEachValue
in interface MapIterable<K,V>
public void forEachKey(Procedure<? super K> procedure)
MapIterable
procedure
with each key of the map.
final Collection<Integer> result = new ArrayList<Integer>(); MutableMap<Integer, String> map = this.newMapWithKeysValues(1, "1", 2, "2", 3, "3"); map.forEachKey(new CollectionAddProcedure<Integer>(result)); Verify.assertContainsAll(result, 1, 2, 3);
forEachKey
in interface MapIterable<K,V>
public void forEachKeyValue(Procedure2<? super K,? super V> procedure2)
MapIterable
procedure
with each key-value pair of the map.
final Collection<String> collection = new ArrayList<String>(); MutableMap<Integer, String> map = this.newMapWithKeysValues(1, "One", 2, "Two", 3, "Three"); map.forEachKeyValue((Integer key, String value) -> collection.add(String.valueOf(key) + value)); Verify.assertContainsAll(collection, "1One", "2Two", "3Three");
forEachKeyValue
in interface MapIterable<K,V>
public Pair<K,V> detect(Predicate2<? super K,? super V> predicate)
MapIterable
Pair<City, Person> detected = peopleByCity.detect((City city, Person person) -> city.getName().equals("Anytown") && person.getLastName().equals("Smith"));
detect
in interface MapIterable<K,V>
public java.util.Optional<Pair<K,V>> detectOptional(Predicate2<? super K,? super V> predicate)
MapIterable
Optional<Pair<City, Person>> detected = peopleByCity.detectOptional((city, person) -> city.getName().equals("Anytown") && person.getLastName().equals("Smith"));
detectOptional
in interface MapIterable<K,V>
public V getIfAbsentPut(K key, Function0<? extends V> function)
MutableMapIterable
getIfAbsentPut
in interface MutableMapIterable<K,V>
public V getIfAbsentPut(K key, V value)
MutableMapIterable
getIfAbsentPut
in interface MutableMapIterable<K,V>
public V getIfAbsentPutWithKey(K key, Function<? super K,? extends V> function)
MutableMapIterable
getIfAbsentPutWithKey
in interface MutableMapIterable<K,V>
public <P> V getIfAbsentPutWith(K key, Function<? super P,? extends V> function, P parameter)
MutableMapIterable
getIfAbsentPutWith
in interface MutableMapIterable<K,V>
public V removeKey(K key)
MutableMapIterable
key
.removeKey
in interface MutableMapIterable<K,V>
Map.remove(Object)
public V add(Pair<K,V> keyValuePair)
MutableMapIterable
add
in interface MutableMapIterable<K,V>
Map.put(Object, Object)
public V updateValue(K key, Function0<? extends V> factory, Function<? super V,? extends V> function)
MutableMapIterable
key
, applies the function
to it, and replaces the value. If there
is no value associated with key
, starts it off with a value supplied by factory
.updateValue
in interface MutableMapIterable<K,V>
public <P> V updateValueWith(K key, Function0<? extends V> factory, Function2<? super V,? super P,? extends V> function, P parameter)
MutableMapIterable
MutableMapIterable.updateValue(Object, Function0, Function)
with a Function2 and specified parameter which is
passed to the function.updateValueWith
in interface MutableMapIterable<K,V>
public <VV> MutableMapIterable<VV,V> groupByUniqueKey(Function<? super V,? extends VV> function)
RichIterable
groupByUniqueKey
in interface MutableMapIterable<K,V>
groupByUniqueKey
in interface RichIterable<K>
groupByUniqueKey
in class AbstractSynchronizedRichIterable<V>
RichIterable.groupBy(Function)
public <KK,VV> MutableMap<KK,VV> aggregateInPlaceBy(Function<? super V,? extends KK> groupBy, Function0<? extends VV> zeroValueFactory, Procedure2<? super VV,? super V> mutatingAggregator)
RichIterable
aggregateInPlaceBy
in interface MutableMapIterable<K,V>
aggregateInPlaceBy
in interface RichIterable<K>
aggregateInPlaceBy
in class AbstractSynchronizedRichIterable<V>
public <KK,VV> MutableMap<KK,VV> aggregateBy(Function<? super V,? extends KK> groupBy, Function0<? extends VV> zeroValueFactory, Function2<? super VV,? super V,? extends VV> nonMutatingAggregator)
RichIterable
aggregateBy
in interface MutableMapIterable<K,V>
aggregateBy
in interface RichIterable<K>
aggregateBy
in class AbstractSynchronizedRichIterable<V>
public RichIterable<Pair<K,V>> keyValuesView()
MapIterable
keyValuesView
in interface MapIterable<K,V>
public <V1> MutableObjectLongMap<V1> sumByInt(Function<? super V,? extends V1> groupBy, IntFunction<? super V> function)
RichIterable
sumByInt
in interface MutableMapIterable<K,V>
sumByInt
in interface RichIterable<K>
sumByInt
in class AbstractSynchronizedRichIterable<V>
public <V1> MutableObjectDoubleMap<V1> sumByFloat(Function<? super V,? extends V1> groupBy, FloatFunction<? super V> function)
RichIterable
sumByFloat
in interface MutableMapIterable<K,V>
sumByFloat
in interface RichIterable<K>
sumByFloat
in class AbstractSynchronizedRichIterable<V>
public <V1> MutableObjectLongMap<V1> sumByLong(Function<? super V,? extends V1> groupBy, LongFunction<? super V> function)
RichIterable
sumByLong
in interface MutableMapIterable<K,V>
sumByLong
in interface RichIterable<K>
sumByLong
in class AbstractSynchronizedRichIterable<V>
public <V1> MutableObjectDoubleMap<V1> sumByDouble(Function<? super V,? extends V1> groupBy, DoubleFunction<? super V> function)
RichIterable
sumByDouble
in interface MutableMapIterable<K,V>
sumByDouble
in interface RichIterable<K>
sumByDouble
in class AbstractSynchronizedRichIterable<V>
public <V1> MutableMultimap<V1,V> groupBy(Function<? super V,? extends V1> function)
RichIterable
Example using a Java 8 method reference:
Multimap<String, Person> peopleByLastName = people.groupBy(Person::getLastName);
Example using an anonymous inner class:
Multimap<String, Person> peopleByLastName = people.groupBy(new Function<Person, String>() { public String valueOf(Person person) { return person.getLastName(); } });
groupBy
in interface MutableMapIterable<K,V>
groupBy
in interface RichIterable<K>
groupBy
in class AbstractSynchronizedRichIterable<V>
public <V1> MutableMultimap<V1,V> groupByEach(Function<? super V,? extends java.lang.Iterable<V1>> function)
RichIterable
RichIterable.groupBy(Function)
, except the result of evaluating function will return a collection of keys
for each value.groupByEach
in interface MutableMapIterable<K,V>
groupByEach
in interface RichIterable<K>
groupByEach
in class AbstractSynchronizedRichIterable<V>
public <S> MutableCollection<Pair<V,S>> zip(java.lang.Iterable<S> that)
RichIterable
RichIterable
formed from this RichIterable
and another RichIterable
by
combining corresponding elements in pairs. If one of the two RichIterable
s is longer than the other, its
remaining elements are ignored.zip
in interface MutableMapIterable<K,V>
zip
in interface RichIterable<K>
zip
in class AbstractSynchronizedRichIterable<V>
S
- the type of the second half of the returned pairsthat
- The RichIterable
providing the second half of each result pairRichIterable
containing pairs consisting of corresponding elements of this
RichIterable
and that. The length of the returned RichIterable
is the minimum of the lengths of
this RichIterable
and that.public MutableCollection<Pair<V,java.lang.Integer>> zipWithIndex()
RichIterable
RichIterable
with its indices.zipWithIndex
in interface MutableMapIterable<K,V>
zipWithIndex
in interface RichIterable<K>
zipWithIndex
in class AbstractSynchronizedRichIterable<V>
RichIterable
containing pairs consisting of all elements of this RichIterable
paired with their index. Indices start at 0.RichIterable.zip(Iterable)
public MutableCollection<V> select(Predicate<? super V> predicate)
RichIterable
Example using a Java 8 lambda expression:
RichIterable<Person> selected = people.select(person -> person.getAddress().getCity().equals("London"));
Example using an anonymous inner class:
RichIterable<Person> selected = people.select(new Predicate<Person>() { public boolean accept(Person person) { return person.getAddress().getCity().equals("London"); } });
select
in interface MutableMapIterable<K,V>
select
in interface RichIterable<K>
select
in class AbstractSynchronizedRichIterable<V>
public <S> MutableCollection<S> selectInstancesOf(java.lang.Class<S> clazz)
RichIterable
clazz
.
RichIterable<Integer> integers = List.mutable.with(new Integer(0), new Long(0L), new Double(0.0)).selectInstancesOf(Integer.class);
selectInstancesOf
in interface MutableMapIterable<K,V>
selectInstancesOf
in interface RichIterable<K>
selectInstancesOf
in class AbstractSynchronizedRichIterable<V>
public <P> MutableCollection<V> selectWith(Predicate2<? super V,? super P> predicate, P parameter)
RichIterable
RichIterable.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));
Example using an anonymous inner class:
RichIterable<Person> selected = people.selectWith(new Predicate2<Person, Integer>() { public boolean accept(Person person, Integer age) { return person.getAge() >= age; } }, Integer.valueOf(18));
selectWith
in interface MutableMapIterable<K,V>
selectWith
in interface RichIterable<K>
selectWith
in class AbstractSynchronizedRichIterable<V>
predicate
- a Predicate2
to use as the select criteriaparameter
- a parameter to pass in for evaluation of the second argument P
in predicate
RichIterable.select(Predicate)
public <P> MutableCollection<V> rejectWith(Predicate2<? super V,? super P> predicate, P parameter)
RichIterable
RichIterable.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));
Example using an anonymous inner class:
MutableList<Person> rejected = people.rejectWith(new Predicate2<Person, Integer>() { public boolean accept(Person person, Integer age) { return person.getAge() < age; } }, Integer.valueOf(18));
rejectWith
in interface MutableMapIterable<K,V>
rejectWith
in interface RichIterable<K>
rejectWith
in class AbstractSynchronizedRichIterable<V>
predicate
- a Predicate2
to use as the select criteriaparameter
- a parameter to pass in for evaluation of the second argument P
in predicate
RichIterable.select(Predicate)
public PartitionMutableCollection<V> partition(Predicate<? super V> predicate)
RichIterable
Example using a Java 8 lambda expression:
PartitionIterable<Person> newYorkersAndNonNewYorkers = people.partition(person -> person.getAddress().getState().getName().equals("New York"));
Example using an anonymous inner class:
PartitionIterable<Person> newYorkersAndNonNewYorkers = people.partition(new Predicate<Person>() { public boolean accept(Person person) { return person.getAddress().getState().getName().equals("New York"); } });
partition
in interface MutableMapIterable<K,V>
partition
in interface RichIterable<K>
partition
in class AbstractSynchronizedRichIterable<V>
public <V1> MutableBag<V1> countBy(Function<? super V,? extends V1> function)
RichIterable
countBy
in interface MutableMapIterable<K,V>
countBy
in interface RichIterable<K>
countBy
in class AbstractSynchronizedRichIterable<V>
public <V1,P> MutableBag<V1> countByWith(Function2<? super V,? super P,? extends V1> function, P parameter)
RichIterable
countByWith
in interface MutableMapIterable<K,V>
countByWith
in interface RichIterable<K>
countByWith
in class AbstractSynchronizedRichIterable<V>
public MutableCollection<V> reject(Predicate<? super V> predicate)
RichIterable
Example using a Java 8 lambda expression:
RichIterable<Person> rejected = people.reject(person -> person.person.getLastName().equals("Smith"));
Example using an anonymous inner class:
RichIterable<Person> rejected = people.reject(new Predicate<Person>() { public boolean accept(Person person) { return person.person.getLastName().equals("Smith"); } });
reject
in interface MutableMapIterable<K,V>
reject
in interface RichIterable<K>
reject
in class AbstractSynchronizedRichIterable<V>
predicate
- a Predicate
to use as the reject criteriaPredicate.accept(Object)
method to evaluate to falsepublic MutableMapIterable<K,V> tap(Procedure<? super V> procedure)
RichIterable
this
.
Example using a Java 8 lambda expression:
RichIterable<Person> tapped = people.tap(person -> LOGGER.info(person.getName()));
Example using an anonymous inner class:
RichIterable<Person> tapped = people.tap(new Procedure<Person>() { public void value(Person person) { LOGGER.info(person.getName()); } });
tap
in interface MapIterable<K,V>
tap
in interface MutableMapIterable<K,V>
tap
in interface RichIterable<K>
tap
in class AbstractSynchronizedRichIterable<V>
RichIterable.each(Procedure)
,
InternalIterable.forEach(Procedure)
Copyright © 2004–2017. All rights reserved.