public interface ImmutableShortObjectMap<V> extends ShortObjectMap<V>
Modifier and Type | Method and Description |
---|---|
<VV> ImmutableCollection<VV> |
collect(Function<? super V,? extends VV> function)
Returns a new collection with the results of applying the specified function on each element of the source
collection.
|
ImmutableBooleanCollection |
collectBoolean(BooleanFunction<? super V> booleanFunction)
Returns a new primitive
boolean iterable with the results of applying the specified function on each element
of the source collection. |
ImmutableByteCollection |
collectByte(ByteFunction<? super V> byteFunction)
Returns a new primitive
byte iterable with the results of applying the specified function on each element
of the source collection. |
ImmutableCharCollection |
collectChar(CharFunction<? super V> charFunction)
Returns a new primitive
char iterable with the results of applying the specified function on each element
of the source collection. |
ImmutableDoubleCollection |
collectDouble(DoubleFunction<? super V> doubleFunction)
Returns a new primitive
double iterable with the results of applying the specified function on each element
of the source collection. |
ImmutableFloatCollection |
collectFloat(FloatFunction<? super V> floatFunction)
Returns a new primitive
float iterable with the results of applying the specified function on each element
of the source collection. |
ImmutableIntCollection |
collectInt(IntFunction<? super V> intFunction)
Returns a new primitive
int iterable with the results of applying the specified function on each element
of the source collection. |
ImmutableLongCollection |
collectLong(LongFunction<? super V> longFunction)
Returns a new primitive
long iterable with the results of applying the specified function on each element
of the source collection. |
ImmutableShortCollection |
collectShort(ShortFunction<? super V> shortFunction)
Returns a new primitive
short iterable with the results of applying the specified function on each element
of the source collection. |
<P,VV> ImmutableCollection<VV> |
collectWith(Function2<? super V,? super P,? extends VV> function,
P parameter)
Same as
RichIterable.collect(Function) with a Function2 and specified parameter which is passed to the block. |
ImmutableShortObjectMap<V> |
newWithKeyValue(short key,
V value) |
ImmutableShortObjectMap<V> |
newWithoutAllKeys(ShortIterable keys) |
ImmutableShortObjectMap<V> |
newWithoutKey(short key) |
ImmutableCollection<V> |
reject(Predicate<? super V> predicate)
Returns all elements of the source collection that return false when evaluating of the predicate.
|
ImmutableShortObjectMap<V> |
reject(ShortObjectPredicate<? super V> predicate) |
ImmutableCollection<V> |
select(Predicate<? super V> predicate)
Returns all elements of the source collection that return true when evaluating the predicate.
|
ImmutableShortObjectMap<V> |
select(ShortObjectPredicate<? super V> predicate) |
<P> ImmutableCollection<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 . |
ImmutableShortObjectMap<V> |
tap(Procedure<? super V> procedure)
Executes the Procedure for each element in the iterable and returns
this . |
containsKey, containsValue, equals, forEachKey, forEachKeyValue, forEachValue, get, getIfAbsent, hashCode, keySet, keysView, keyValuesView, toImmutable, toString, values
aggregateBy, aggregateInPlaceBy, allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, asLazy, chunk, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectIf, collectInt, collectLong, collectShort, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, count, countWith, detect, detectIfNone, detectWith, detectWithIfNone, each, flatCollect, flatCollect, getFirst, getLast, groupBy, groupBy, groupByEach, groupByEach, groupByUniqueKey, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, isEmpty, makeString, makeString, makeString, max, max, maxBy, min, min, minBy, noneSatisfy, noneSatisfyWith, notEmpty, partition, partitionWith, reject, rejectWith, rejectWith, select, selectInstancesOf, selectWith, size, sumByDouble, sumByFloat, sumByInt, sumByLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toList, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toSortedSetBy, zip, zip, zipWithIndex, zipWithIndex
forEach, forEachWith, forEachWithIndex
forEach, iterator, spliterator
ImmutableShortObjectMap<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() { public void value(Person person) { LOGGER.info(person.getName()); } });
tap
in interface RichIterable<V>
tap
in interface ShortObjectMap<V>
RichIterable.each(Procedure)
,
InternalIterable.forEach(Procedure)
ImmutableShortObjectMap<V> select(ShortObjectPredicate<? super V> predicate)
select
in interface ShortObjectMap<V>
ImmutableShortObjectMap<V> reject(ShortObjectPredicate<? super V> predicate)
reject
in interface ShortObjectMap<V>
ImmutableCollection<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 RichIterable<V>
<P> ImmutableCollection<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 RichIterable<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)
ImmutableCollection<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 RichIterable<V>
predicate
- a Predicate
to use as the reject criteriaPredicate.accept(Object)
method to evaluate to false<VV> ImmutableCollection<VV> collect(Function<? super V,? extends VV> function)
RichIterable
Example using a Java 8 lambda expression:
RichIterable<String> names = people.collect(person -> person.getFirstName() + " " + person.getLastName());
Example using an anonymous inner class:
RichIterable<String> names = people.collect(new Function<Person, String>() { public String valueOf(Person person) { return person.getFirstName() + " " + person.getLastName(); } });
collect
in interface RichIterable<V>
ImmutableBooleanCollection collectBoolean(BooleanFunction<? super V> booleanFunction)
RichIterable
boolean
iterable 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:
BooleanIterable licenses = people.collectBoolean(person -> person.hasDrivingLicense());
Example using an anonymous inner class:
BooleanIterable licenses = people.collectBoolean(new BooleanFunction<Person>() { public boolean booleanValueOf(Person person) { return person.hasDrivingLicense(); } });
collectBoolean
in interface RichIterable<V>
ImmutableByteCollection collectByte(ByteFunction<? super V> byteFunction)
RichIterable
byte
iterable 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:
ByteIterable bytes = people.collectByte(person -> person.getCode());
Example using an anonymous inner class:
ByteIterable bytes = people.collectByte(new ByteFunction<Person>() { public byte byteValueOf(Person person) { return person.getCode(); } });
collectByte
in interface RichIterable<V>
ImmutableCharCollection collectChar(CharFunction<? super V> charFunction)
RichIterable
char
iterable 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:
CharIterable chars = people.collectChar(person -> person.getMiddleInitial());
Example using an anonymous inner class:
CharIterable chars = people.collectChar(new CharFunction<Person>() { public char charValueOf(Person person) { return person.getMiddleInitial(); } });
collectChar
in interface RichIterable<V>
ImmutableDoubleCollection collectDouble(DoubleFunction<? super V> doubleFunction)
RichIterable
double
iterable 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:
DoubleIterable doubles = people.collectDouble(person -> person.getMilesFromNorthPole());
Example using an anonymous inner class:
DoubleIterable doubles = people.collectDouble(new DoubleFunction<Person>() { public double doubleValueOf(Person person) { return person.getMilesFromNorthPole(); } });
collectDouble
in interface RichIterable<V>
ImmutableFloatCollection collectFloat(FloatFunction<? super V> floatFunction)
RichIterable
float
iterable 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:
FloatIterable floats = people.collectFloat(person -> person.getHeightInInches());
Example using an anonymous inner class:
FloatIterable floats = people.collectFloat(new FloatFunction<Person>() { public float floatValueOf(Person person) { return person.getHeightInInches(); } });
collectFloat
in interface RichIterable<V>
ImmutableIntCollection collectInt(IntFunction<? super V> intFunction)
RichIterable
int
iterable 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:
IntIterable ints = people.collectInt(person -> person.getAge());
Example using an anonymous inner class:
IntIterable ints = people.collectInt(new IntFunction<Person>() { public int intValueOf(Person person) { return person.getAge(); } });
collectInt
in interface RichIterable<V>
ImmutableLongCollection collectLong(LongFunction<? super V> longFunction)
RichIterable
long
iterable 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:
LongIterable longs = people.collectLong(person -> person.getGuid());
Example using an anonymous inner class:
LongIterable longs = people.collectLong(new LongFunction<Person>() { public long longValueOf(Person person) { return person.getGuid(); } });
collectLong
in interface RichIterable<V>
ImmutableShortCollection collectShort(ShortFunction<? super V> shortFunction)
RichIterable
short
iterable 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:
ShortIterable shorts = people.collectShort(person -> person.getNumberOfJunkMailItemsReceivedPerMonth());
Example using an anonymous inner class:
ShortIterable shorts = people.collectShort(new ShortFunction<Person>() { public short shortValueOf(Person person) { return person.getNumberOfJunkMailItemsReceivedPerMonth(); } });
collectShort
in interface RichIterable<V>
<P,VV> ImmutableCollection<VV> collectWith(Function2<? super V,? super P,? extends VV> function, P parameter)
RichIterable
RichIterable.collect(Function)
with a Function2
and specified parameter which is passed to the block.
Example using a Java 8 lambda expression:
RichIterable<Integer> integers = Lists.mutable.with(1, 2, 3).collectWith((each, parameter) -> each + parameter, Integer.valueOf(1));
Example using an anonymous inner class:
Function2<Integer, Integer, Integer> addParameterFunction = new Function2<Integer, Integer, Integer>() { public Integer value(Integer each, Integer parameter) { return each + parameter; } }; RichIterable<Integer> integers = Lists.mutable.with(1, 2, 3).collectWith(addParameterFunction, Integer.valueOf(1));
collectWith
in interface RichIterable<V>
function
- A Function2
to use as the collect transformation functionparameter
- A parameter to pass in for evaluation of the second argument P
in function
RichIterable
that contains the transformed elements returned by Function2.value(Object, Object)
RichIterable.collect(Function)
ImmutableShortObjectMap<V> newWithKeyValue(short key, V value)
ImmutableShortObjectMap<V> newWithoutKey(short key)
ImmutableShortObjectMap<V> newWithoutAllKeys(ShortIterable keys)
Copyright © 2004–2016. All rights reserved.