| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | allSatisfy(Predicate<? super V> predicate)
Overrides org. Implements org. Returns true if the predicate evaluates to true for every element of the iterable or if the iterable is empty. |
| public <P> boolean | allSatisfyWith(Predicate2<? super V, ? super P> predicate, P parameter)
Overrides org. Implements org. Returns true if the predicate evaluates to true for every element of the collection, or returns false. |
| public boolean | anySatisfy(Predicate<? super V> predicate)
Overrides org. Implements org. Returns true if the predicate evaluates to true for any element of the iterable. |
| public <P> boolean | anySatisfyWith(Predicate2<? super V, ? super P> predicate, P parameter)
Overrides org. Implements org. Returns true if the predicate evaluates to true for any element of the collection, or return false. |
| public LazyIterable | asLazy()
Overrides org. Implements org. Returns a lazy (deferred) iterable, most likely implemented by calling LazyIterate.adapt(this). |
| public RichIterable | chunk(int size)
Implements org. Partitions elements in fixed size chunks. |
| public boolean | contains(Object object)
Overrides org. Implements org. Returns true if the iterable has an element which responds true to element.equals(object). |
| public V | detect(Predicate<? super V> predicate)
Overrides org. Implements org. Returns the first element of the iterable for which the predicate evaluates to true or null in the case where no element returns true. |
| public V | detectIfNone(Predicate<? super V> predicate, Function0<? extends V> function)
Overrides default org. Returns the first element of the iterable for which the predicate evaluates to true. |
| public Optional | detectOptional(Predicate<? super V> predicate)
Overrides org. Implements org. Returns the first element of the iterable for which the predicate evaluates to true as an Optional. |
| public <P> V | detectWith(Predicate2<? super V, ? super P> predicate, P parameter)
Overrides org. Implements org. Returns the first element that evaluates to true for the specified predicate2 and parameter, or null if none evaluate to true. |
| public <P> V | detectWithIfNone(Predicate2<? super V, ? super P> predicate, P parameter, Function0<? extends V> function)
Overrides org. Implements org. Returns the first element of the iterable that evaluates to true for the specified predicate2 and parameter, or returns the value of evaluating the specified function. |
| public <P> Optional | detectWithOptional(Predicate2<? super V, ? super P> predicate, P parameter)
Overrides org. Implements org. Returns the first element that evaluates to true for the specified predicate2 and parameter as an Optional. |
| public void | each(Procedure<? super V> procedure)
Implements org. The procedure is executed for each element in the iterable. |
| public void | forEachKey(Procedure<? super K> procedure)
Implements org. Calls the |
| public void | forEachValue(Procedure<? super V> procedure)
Implements org. Calls the procedure with each value of the map. |
| public <P> void | forEachWith(Procedure2<? super V, ? super P> procedure2, P parameter)
Overrides org. Implements org. The procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument. |
| public void | forEachWithIndex(ObjectIntProcedure<? super V> objectIntProcedure)
Overrides org. Implements org. Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure. |
| public V | getFirst()
Implements org. Returns the first element of an iterable. |
| public V | getIfAbsent(K key, Function0<? extends V> function)
Implements org. 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. |
| public V | getIfAbsentValue(K key, V value)
Implements org. Return the value in the Map that corresponds to the specified key, or if there is no value at the key, return |
| public <P> V | getIfAbsentWith(K key, Function<? super P, ? extends V> function, P parameter)
Implements org. 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. |
| public V | getLast()
Implements org. Returns the last element of an iterable. |
| public V | getOnly()
Overrides default org. Returns the element if the iterable has exactly one element. |
| public V | getOrDefault(Object key, V defaultValue)
Overrides default org.
|
| public <A> A | ifPresentApply(K key, Function<? super V, ? extends A> function)
Implements org. 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. |
| protected boolean | |
| protected boolean | |
| protected int | |
| public boolean | noneSatisfy(Predicate<? super V> predicate)
Overrides org. Implements org. Returns true if the predicate evaluates to false for every element of the iterable or if the iterable is empty. |
| public <P> boolean | noneSatisfyWith(Predicate2<? super V, ? super P> predicate, P parameter)
Overrides org. Implements org. Returns true if the predicate evaluates to false for every element of the collection, or return false. |
| public Object[] | toArray()
Overrides default org. Converts this iterable to an array. |
| public <T> T[] | toArray(T[] a)
Overrides default org. Converts this iterable to an array using the specified target array, assuming the target array is as long or longer than the iterable. |
| AbstractMapIterable | back to summary |
|---|---|
| public AbstractMapIterable() | |
| allSatisfy | back to summary |
|---|---|
| public boolean allSatisfy(Predicate<? super V> predicate) Overrides org. Implements org. Doc from org. Returns true if the predicate evaluates to true for every element of the iterable or if the iterable is empty. Otherwise, returns false.
| |
| allSatisfyWith | back to summary |
|---|---|
| public <P> boolean allSatisfyWith(Predicate2<? super V, ? super P> predicate, P parameter) Overrides org. Implements org. Doc from org. Returns true if the predicate evaluates to true for every element of the collection, or returns false.
| |
| anySatisfy | back to summary |
|---|---|
| public boolean anySatisfy(Predicate<? super V> predicate) Overrides org. Implements org. Doc from org. Returns true if the predicate evaluates to true for any element of the iterable. Returns false if the iterable is empty, or if no element returned true when evaluating the predicate.
| |
| anySatisfyWith | back to summary |
|---|---|
| public <P> boolean anySatisfyWith(Predicate2<? super V, ? super P> predicate, P parameter) Overrides org. Implements org. Doc from org. Returns true if the predicate evaluates to true for any element of the collection, or return false. Returns false if the collection is empty.
| |
| asLazy | back to summary |
|---|---|
| public LazyIterable Overrides org. Implements org. Doc from org. Returns a lazy (deferred) iterable, most likely implemented by calling LazyIterate.adapt(this).
| |
| chunk | back to summary |
|---|---|
| public RichIterable Implements org. Doc from org. Partitions elements in fixed size chunks.
| |
| contains | back to summary |
|---|---|
| public boolean contains(Object object) Overrides org. Implements org. Doc from org. Returns true if the iterable has an element which responds true to element.equals(object).
| |
| detect | back to summary |
|---|---|
| public V detect(Predicate<? super V> predicate) Overrides org. Implements org. Doc from org. Returns the first element of the iterable for which the predicate evaluates to true or null in the case where no element returns true. This method is commonly called find. Example using a Java 8 lambda expression:
Person person =
people.detect(person -> person.getFirstName().equals("John") && person.getLastName().equals("Smith"));
| |
| detectIfNone | back to summary |
|---|---|
| public V detectIfNone(Predicate<? super V> predicate, Function0<? extends V> function) Overrides default org. Doc from org. Returns the first element of the iterable for which the predicate evaluates to true. If no element matches the predicate, then returns the value of applying the specified function.
| |
| detectOptional | back to summary |
|---|---|
| public Optional Overrides org. Implements org. Doc from org. Returns the first element of the iterable for which the predicate evaluates to true as an Optional. This method is commonly called find. Example using a Java 8 lambda expression:
Person person =
people.detectOptional(person -> person.getFirstName().equals("John") && person.getLastName().equals("Smith"));
| |
| detectWith | back to summary |
|---|---|
| public <P> V detectWith(Predicate2<? super V, ? super P> predicate, P parameter) Overrides org. Implements org. Doc from org. Returns the first element that evaluates to true for the specified predicate2 and parameter, or null if none evaluate to true. Example using a Java 8 lambda expression:
Person person =
people.detectWith((person, fullName) -> person.getFullName().equals(fullName), "John Smith");
| |
| detectWithIfNone | back to summary |
|---|---|
| public <P> V detectWithIfNone(Predicate2<? super V, ? super P> predicate, P parameter, Function0<? extends V> function) Overrides org. Implements org. Doc from org. Returns the first element of the iterable that evaluates to true for the specified predicate2 and parameter, or returns the value of evaluating the specified function.
| |
| detectWithOptional | back to summary |
|---|---|
| public <P> Optional Overrides org. Implements org. Doc from org. Returns the first element that evaluates to true for the specified predicate2 and parameter as an Optional. Example using a Java 8 lambda expression:
Optional<Person> person =
people.detectWithOptional((person, fullName) -> person.getFullName().equals(fullName), "John Smith");
| |
| each | back to summary |
|---|---|
| public void each(Procedure<? super V> procedure) Implements org. Doc from org. The procedure is executed for each element in the iterable. Example using a Java 8 lambda expression: people.each(person -> LOGGER.info(person.getName()));This method is a variant of InternalIterable#forEach(Procedure)
that has a signature conflict with Iterable#forEach(java..
| |
| forEachKey | back to summary |
|---|---|
| public void forEachKey(Procedure<? super K> procedure) Implements org. Doc from org. Calls the
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);
| |
| forEachValue | back to summary |
|---|---|
| public void forEachValue(Procedure<? super V> procedure) Implements org. Doc from org. Calls the procedure with each value of the map.
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);
| |
| forEachWith | back to summary |
|---|---|
| public <P> void forEachWith(Procedure2<? super V, ? super P> procedure2, P parameter) Overrides org. Implements org. Doc from org. The procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument. Example using a Java 8 lambda:
people.forEachWith((Person person, Person other) ->
{
if (person.isRelatedTo(other))
{
LOGGER.info(person.getName());
}
}, fred);
Example using an anonymous inner class:
people.forEachWith(new Procedure2<Person, Person>()
{
public void value(Person person, Person other)
{
if (person.isRelatedTo(other))
{
LOGGER.info(person.getName());
}
}
}, fred);
| |
| forEachWithIndex | back to summary |
|---|---|
| public void forEachWithIndex(ObjectIntProcedure<? super V> objectIntProcedure) Overrides org. Implements org. Doc from org. Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure. Example using a Java 8 lambda:
people.forEachWithIndex((Person person, int index) -> LOGGER.info("Index: " + index + " person: " + person.getName()));
Example using an anonymous inner class:
people.forEachWithIndex(new ObjectIntProcedure<Person>()
{
public void value(Person person, int index)
{
LOGGER.info("Index: " + index + " person: " + person.getName());
}
});
| |
| getFirst | back to summary |
|---|---|
| public V getFirst() Implements org. Doc from org. Returns the first element of an iterable. In the case of a List it is the element at the first index. In the case of any other Collection, it is the first element that would be returned during an iteration. If the iterable is empty, null is returned. If null is a valid element of the container, then a developer would need to check to see if the iterable is empty to validate that a null result was not due to the container being empty. The order of Sets are not guaranteed (except for TreeSets and other Ordered Set implementations), so if you use this method, the first element could be any element from the Set.
| |
| getIfAbsent | back to summary |
|---|---|
| public V getIfAbsent(K key, Function0<? extends V> function) Implements org. Doc from org. 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.
| |
| getIfAbsentValue | back to summary |
|---|---|
| public V getIfAbsentValue(K key, V value) Implements org. Doc from org. Return the value in the Map that corresponds to the specified key, or if there is no value at the key, return
| |
| getIfAbsentWith | back to summary |
|---|---|
| public <P> V getIfAbsentWith(K key, Function<? super P, ? extends V> function, P parameter) Implements org. Doc from org. 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.
| |
| getLast | back to summary |
|---|---|
| public V getLast() Implements org. Doc from org. Returns the last element of an iterable. In the case of a List it is the element at the last index. In the case of any other Collection, it is the last element that would be returned during an iteration. If the iterable is empty, null is returned. If null is a valid element of the container, then a developer would need to check to see if the iterable is empty to validate that a null result was not due to the container being empty. The order of Sets are not guaranteed (except for TreeSets and other Ordered Set implementations), so if you use this method, the last element could be any element from the Set.
| |
| getOnly | back to summary |
|---|---|
| public V getOnly() Overrides default org. Doc from org. Returns the element if the iterable has exactly one element. Otherwise, throw
| |
| getOrDefault | back to summary |
|---|---|
| public V getOrDefault(Object key, V defaultValue) Overrides default org.
| |
| ifPresentApply | back to summary |
|---|---|
| public <A> A ifPresentApply(K key, Function<? super V, ? extends A> function) Implements org. Doc from org. 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.
| |
| isAbsent | back to summary |
|---|---|
| protected boolean isAbsent(V result, K key) | |
| keyAndValueEquals | back to summary |
|---|---|
| protected boolean keyAndValueEquals(K key, V value, Map<K, V> map) | |
| keyAndValueHashCode | back to summary |
|---|---|
| protected int keyAndValueHashCode(K key, V value) | |
| noneSatisfy | back to summary |
|---|---|
| public boolean noneSatisfy(Predicate<? super V> predicate) Overrides org. Implements org. Doc from org. Returns true if the predicate evaluates to false for every element of the iterable or if the iterable is empty. Otherwise, returns false.
| |
| noneSatisfyWith | back to summary |
|---|---|
| public <P> boolean noneSatisfyWith(Predicate2<? super V, ? super P> predicate, P parameter) Overrides org. Implements org. Doc from org. Returns true if the predicate evaluates to false for every element of the collection, or return false. Returns true if the collection is empty.
| |
| toArray | back to summary |
|---|---|
| public Object[] toArray() Overrides default org. Doc from org. Converts this iterable to an array.
| |
| toArray | back to summary |
|---|---|
| public <T> T[] toArray(T[] a) Overrides default org. Doc from org. Converts this iterable to an array using the specified target array, assuming the target array is as long or longer than the iterable.
| |