| Modifier and Type | Method and Description |
|---|---|
| public <V> MutableSetIterableMultimap | groupBy(Function<? super T, ? extends V> function)
Redeclares org. For each element of the iterable, the function is evaluated and the results of these evaluations are collected into a new multimap, where the transformed value is the key and the original values are added to the same (or similar) species of collection as the source iterable. |
| public <V> MutableSetIterableMultimap | groupByEach(Function<? super T, ? extends Iterable<V>> function)
Redeclares org. Similar to |
| public PartitionMutableSetIterable | partition(Predicate<? super T> predicate)
Redeclares org. Filters a collection into a PartitionedIterable based on the evaluation of the predicate. |
| public <P> PartitionMutableSetIterable | partitionWith(Predicate2<? super T, ? super P> predicate, P parameter)
Redeclares org. Filters a collection into a PartitionIterable based on the evaluation of the predicate. |
| public MutableSetIterable | reject(Predicate<? super T> predicate)
Redeclares org. Returns a MutableCollection with all elements that evaluate to false for the specified predicate. |
| public <P> MutableSetIterable | rejectWith(Predicate2<? super T, ? super P> predicate, P parameter)
Redeclares org. Returns a MutableCollection with all elements that evaluate to false for the specified predicate2 and parameter. |
| public MutableSetIterable | select(Predicate<? super T> predicate)
Redeclares org. Returns a MutableCollection with all elements that evaluate to true for the specified predicate. |
| public <S> MutableSetIterable | selectInstancesOf(Class<S> clazz)
Redeclares org. Returns all elements of the source collection that are instances of the Class |
| public <P> MutableSetIterable | selectWith(Predicate2<? super T, ? super P> predicate, P parameter)
Redeclares org. Returns a MutableCollection with all elements that evaluate to true for the specified predicate2 and parameter. |
| public MutableSetIterable | tap(Procedure<? super T> procedure)
Redeclares org. Executes the Procedure for each element in the iterable and returns |
| public default Object[] | toArray()
Overrides default org. Implements java. Returns an array containing all of the elements in this set. |
| public default <T1> T1[] | toArray(T1[] a)
Overrides default org. Implements java. Returns an array containing all of the elements in this set; the runtime type of the returned array is that of the specified array. |
| public default MutableSetIterable | with(T element)
Implements org. This method allows mutable and fixed size collections the ability to add elements to their existing elements. |
| public default MutableSetIterable | withAll(Iterable<? extends T> elements)
Implements org. This method allows mutable and fixed size collections the ability to add multiple elements to their existing elements. |
| public default MutableSetIterable | without(T element)
Implements org. This method allows mutable and fixed size collections the ability to remove elements from their existing elements. |
| public default MutableSetIterable | withoutAll(Iterable<? extends T> elements)
Implements org. This method allows mutable and fixed size collections the ability to remove multiple elements from their existing elements. |
| public <S> MutableCollection | zip(Iterable<S> that)
Redeclares org.
Deprecated
in 6.0. Use
OrderedIterable#zip(Iterable) instead.
Returns a |
| public MutableSetIterable | zipWithIndex()
Redeclares org.
Deprecated
in 6.0. Use
OrderedIterable#zipWithIndex() instead.
Zips this |
| groupBy | back to summary |
|---|---|
| public <V> MutableSetIterableMultimap Redeclares org. Doc from org. For each element of the iterable, the function is evaluated and the results of these evaluations are collected into a new multimap, where the transformed value is the key and the original values are added to the same (or similar) species of collection as the source iterable. Example using a Java 8 method reference:
Multimap<String, Person> peopleByLastName =
people.groupBy(Person::getLastName);
Co-variant example for MutableCollection:
MutableMultimap<String, Person> peopleByLastName =
people.groupBy(Person::getLastName);
| |
| groupByEach | back to summary |
|---|---|
| public <V> MutableSetIterableMultimap Redeclares org. Doc from org. Similar to
| |
| partition | back to summary |
|---|---|
| public PartitionMutableSetIterable Redeclares org. Doc from org. Filters a collection into a PartitionedIterable based on the evaluation of the predicate. Example using a Java 8 lambda expression:
PartitionIterable<Person> newYorkersAndNonNewYorkers =
people.partition(person -> person.getAddress().getState().getName().equals("New York"));
Co-variant example for MutableCollection:
PartitionMutableCollection<Person> newYorkersAndNonNewYorkers =
people.partition(person -> person.getAddress().getState().getName().equals("New York"));
| |
| partitionWith | back to summary |
|---|---|
| public <P> PartitionMutableSetIterable Redeclares org. Doc from org. Filters a collection into a PartitionIterable based on the evaluation of the predicate. Example using a Java 8 lambda expression:
PartitionIterable<Person> newYorkersAndNonNewYorkers =
people.partitionWith((Person person, String state) -> person.getAddress().getState().getName().equals(state), "New York");
Co-variant example for MutableCollection:
PartitionMutableCollection<Person> newYorkersAndNonNewYorkers =
people.partitionWith((Person person, String state) -> person.getAddress().getState().getName().equals(state), "New York");
| |
| reject | back to summary |
|---|---|
| public MutableSetIterable Redeclares org. Doc from org. Returns a MutableCollection with all elements that evaluate to false for the specified predicate.
MutableCollection<Person> notSmiths =
people.reject(person -> person.person.getLastName().equals("Smith"));
Using the Predicates factory:
MutableCollection<Person> notSmiths = people.reject(Predicates.attributeEqual("lastName", "Smith"));
| |
| rejectWith | back to summary |
|---|---|
| public <P> MutableSetIterable Redeclares org. Doc from org. Returns a MutableCollection with all elements that evaluate to false for the specified predicate2 and parameter. e.g.
MutableCollection<Integer> selected =
integers.rejectWith(Predicates2.equal(), Integer.valueOf(5));
| |
| select | back to summary |
|---|---|
| public MutableSetIterable Redeclares org. Doc from org. Returns a MutableCollection with all elements that evaluate to true for the specified predicate.
MutableCollection<Integer> livesInLondon =
people.select(person -> person.getAddress().getCity().equals("London"));
| |
| selectInstancesOf | back to summary |
|---|---|
| public <S> MutableSetIterable Redeclares org. Doc from org. Returns all elements of the source collection that are instances of the Class
RichIterable<Integer> integers =
List.mutable.with(new Integer(0), new Long(0L), new Double(0.0)).selectInstancesOf(Integer.class);
Co-variant example for MutableCollection:
MutableCollection<Integer> integers =
List.mutable.with(new Integer(0), new Long(0L), new Double(0.0)).selectInstancesOf(Integer.class);
| |
| selectWith | back to summary |
|---|---|
| public <P> MutableSetIterable Redeclares org. Doc from org. Returns a MutableCollection with all elements that evaluate to true for the specified predicate2 and parameter.
MutableCollection<Integer> fives =
integers.selectWith(Predicates2.equal(), Integer.valueOf(5));
| |
| tap | back to summary |
|---|---|
| public MutableSetIterable Redeclares org. Doc from org. Executes the Procedure for each element in the iterable and returns Example using a Java 8 lambda expression:
RichIterable<Person> tapped =
people.tap(person -> LOGGER.info(person.getName()));
| |
| toArray | back to summary |
|---|---|
| public default Object[] toArray() Overrides default org. Implements java. Doc from java. Returns an array containing all of the elements in this set. If this set makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order. The returned array will be "safe" in that no references to it are maintained by this set. (In other words, this method must allocate a new array even if this set is backed by an array). The caller is thus free to modify the returned array. This method acts as bridge between array-based and collection-based APIs.
| |
| toArray | back to summary |
|---|---|
| public default <T1> T1[] toArray(T1[] a) Overrides default org. Implements java. Doc from java. Returns an array containing all of the elements in this set; the runtime type of the returned array is that of the specified array. If the set fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this set. If this set fits in the specified array with room to spare
(i.e., the array has more elements than this set), the element in
the array immediately following the end of the set is set to
If this set makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order. Like the Suppose
String[] y = x.toArray(new String[0]);
Note that toArray(new Object[0]) is identical in function to
toArray().
| |
| with | back to summary |
|---|---|
| public default MutableSetIterable Implements org. Doc from org. This method allows mutable and fixed size collections the ability to add elements to their existing elements. In order to support fixed size a new instance of a collection would have to be returned taking the elements of the original collection and appending the new element to form the new collection. In the case of mutable collections, the original collection is modified, and is returned. In order to use this method properly with mutable and fixed size collections the following approach must be taken:
MutableCollection<String> list = list.with("1");
list = list.with("2");
return list;
In the case of FixedSizeCollection a new instance of MutableCollection will be returned by with, and any
variables that previously referenced the original collection will need to be redirected to reference the
new instance. For other MutableCollection types you will replace the reference to collection with the same
collection, since the instance will return "this" after calling add on itself.
| |
| withAll | back to summary |
|---|---|
| public default MutableSetIterable Implements org. Doc from org. This method allows mutable and fixed size collections the ability to add multiple elements to their existing elements. In order to support fixed size a new instance of a collection would have to be returned taking the elements of the original collection and appending the new elements to form the new collection. In the case of mutable collections, the original collection is modified, and is returned. In order to use this method properly with mutable and fixed size collections the following approach must be taken:
MutableCollection<String> list = list.withAll(FastList.newListWith("1", "2"));
In the case of FixedSizeCollection a new instance of MutableCollection will be returned by withAll, and
any variables that previously referenced the original collection will need to be redirected to reference the
new instance. For other MutableCollection types you will replace the reference to collection with the same
collection, since the instance will return "this" after calling addAll on itself.
| |
| without | back to summary |
|---|---|
| public default MutableSetIterable Implements org. Doc from org. This method allows mutable and fixed size collections the ability to remove elements from their existing elements. In order to support fixed size a new instance of a collection would have to be returned containing the elements that would be left from the original collection after calling remove. In the case of mutable collections, the original collection is modified, and is returned. In order to use this method properly with mutable and fixed size collections the following approach must be taken:
MutableCollection<String> list = list.without("1");
list = list.without("2");
return list;
In the case of FixedSizeCollection a new instance of MutableCollection will be returned by without, and
any variables that previously referenced the original collection will need to be redirected to reference the
new instance. For other MutableCollection types you will replace the reference to collection with the same
collection, since the instance will return "this" after calling remove on itself.
| |
| withoutAll | back to summary |
|---|---|
| public default MutableSetIterable Implements org. Doc from org. This method allows mutable and fixed size collections the ability to remove multiple elements from their existing elements. In order to support fixed size a new instance of a collection would have to be returned containing the elements that would be left from the original collection after calling removeAll. In the case of mutable collections, the original collection is modified, and is returned. In order to use this method properly with mutable and fixed size collections the following approach must be taken:
MutableCollection<String> list = list.withoutAll(FastList.newListWith("1", "2"));
In the case of FixedSizeCollection a new instance of MutableCollection will be returned by withoutAll,
and any variables that previously referenced the original collection will need to be redirected to reference the
new instance. For other MutableCollection types you will replace the reference to collection with the same
collection, since the instance will return "this" after calling removeAll on itself.
| |
| zip | back to summary |
|---|---|
| public <S> MutableCollection Redeclares org. Doc from org. Deprecated in 6.0. Use Returns a
| |
| zipWithIndex | back to summary |
|---|---|
| public MutableSetIterable Redeclares org. Doc from org. Deprecated in 6.0. Use Zips this
| |