| Access | Constructor and Description |
|---|---|
| public |
| AbstractMutableSet | back to summary |
|---|---|
| public AbstractMutableSet() | |
| asSynchronized | back to summary |
|---|---|
| public MutableSet Implements org. Doc from org. Returns a synchronized wrapper backed by this collection. This is the equivalent of using
MutableCollection synchedCollection = collection.asSynchronized();
...
synchedCollection.forEach(each -> ... );
synchedCollection.select(each -> ... );
synchedCollection.collect(each -> ... );
If you want to iterate using an imperative style, you must protect external iterators using
a synchronized block. This includes explicit iterators as well as JDK 5 style for loops.
| |
| asUnmodifiable | back to summary |
|---|---|
| public MutableSet Implements org. Doc from org. Returns an unmodifiable view of the set.
| |
| cartesianProduct | back to summary |
|---|---|
| public <B> LazyIterable Implements org. Doc from org. Returns the set whose members are all possible ordered pairs (a, b) where a is a member of
| |
| clone | back to summary |
|---|---|
| public MutableSet Overrides java. Implements org. Doc from java. Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object will be true, and that the expression:x.clone() != x will bex.clone().getClass() == x.getClass() true, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x) true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by
| |
| collect | back to summary |
|---|---|
| public <V> MutableSet Implements org. Doc from org. Returns a new collection 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:
RichIterable<String> names =
people.collect(person -> person.getFirstName() + " " + person.getLastName());
| |
| collectIf | back to summary |
|---|---|
| public <V> MutableSet Implements org. Doc from org. Returns a new collection with the results of applying the specified function on each element of the source collection, but only for those elements which return true upon evaluation of the predicate. This is the optimized equivalent of calling iterable.select(predicate).collect(function). Example using a Java 8 lambda and method reference: RichIterable<String> strings = Lists.mutable.with(1, 2, 3).collectIf(e -> e != null, Object::toString); Example using Predicates factory: RichIterable<String> strings = Lists.mutable.with(1, 2, 3).collectIf(Predicates.notNull(), Functions.getToString());
| |
| collectWith | back to summary |
|---|---|
| public <P, V> MutableSet Implements org. Doc from org. Same as Example using a Java 8 lambda expression:
RichIterable<Integer> integers =
Lists.mutable.with(1, 2, 3).collectWith((each, parameter) -> each + parameter, Integer.valueOf(1));
| |
| difference | back to summary |
|---|---|
| public MutableSet Implements org. Doc from org. Returns the set of all members of
| |
| differenceInto | back to summary |
|---|---|
| public <R extends Set Implements org. Doc from org. Same as
| |
| flatCollect | back to summary |
|---|---|
| public <V> MutableSet Implements org. Doc from org.
Consider the following example where we have a Function<Person, List<Address>> addressFunction = Person::getAddresses; RichIterable<Person> people = ...;Using collect returns a collection of collections of addresses.
RichIterable<List<Address>> addresses = people.collect(addressFunction);Using flatCollect returns a single flattened list of addresses.
RichIterable<Address> addresses = people.flatCollect(addressFunction);
| |
| groupBy | back to summary |
|---|---|
| public <V> UnifiedSetMultimap Implements 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);
| |
| groupByEach | back to summary |
|---|---|
| public <V> UnifiedSetMultimap Implements org. Doc from org. Similar to
| |
| intersect | back to summary |
|---|---|
| public MutableSet Implements org. Doc from org. Returns the set of all objects that are members of both Note If you need to ensure that the memory references from
| |
| intersectInto | back to summary |
|---|---|
| public <R extends Set Implements org. Doc from org. Same as
| |
| isProperSubsetOf | back to summary |
|---|---|
| public boolean isProperSubsetOf(SetIterable<? extends T> candidateSuperset) Implements org. Doc from org. Returns true if all the members of
| |
| isSubsetOf | back to summary |
|---|---|
| public boolean isSubsetOf(SetIterable<? extends T> candidateSuperset) Implements org. Doc from org. Returns true if all the members of
| |
| newEmpty | back to summary |
|---|---|
| public MutableSet Implements org. Doc from org. Creates a new empty mutable version of the same collection type. For example, if this instance is a FastList, this method will return a new empty FastList. If the class of this instance is immutable or fixed size (i.e. SingletonList) then a mutable alternative to the class will be provided.
| |
| newEmptySameSize | back to summary |
|---|---|
| protected <K> MutableSet | |
| partition | back to summary |
|---|---|
| public PartitionMutableSet Implements 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"));
| |
| partitionWith | back to summary |
|---|---|
| public <P> PartitionMutableSet Implements 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");
| |
| powerSet | back to summary |
|---|---|
| public MutableSet Implements org. Doc from org. Returns the set whose members are all possible subsets of
| |
| reject | back to summary |
|---|---|
| public MutableSet Implements org. Doc from org. 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"));
| |
| rejectWith | back to summary |
|---|---|
| public <P> MutableSet Implements org. Doc from org. Similar to
E.g. return a Example using a Java 8 lambda expression:
RichIterable<Person> rejected =
people.rejectWith((Person person, Integer age) -> person.getAge() < age, Integer.valueOf(18));
| |
| removeAllIterable | back to summary |
|---|---|
| public boolean removeAllIterable(Iterable<?> iterable) Overrides org. Implements org.
| |
| select | back to summary |
|---|---|
| public MutableSet Implements org. Doc from org. 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"));
| |
| selectInstancesOf | back to summary |
|---|---|
| public <S> MutableSet Implements 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);
| |
| selectWith | back to summary |
|---|---|
| public <P> MutableSet Implements org. Doc from org. Similar to
E.g. return a Example using a Java 8 lambda expression:
RichIterable<Person> selected =
people.selectWith((Person person, Integer age) -> person.getAge()>= age, Integer.valueOf(18));
| |
| symmetricDifference | back to summary |
|---|---|
| public MutableSet Implements org. Doc from org. Returns the set of all objects that are a member of exactly one of
| |
| symmetricDifferenceInto | back to summary |
|---|---|
| public <R extends Set Implements org. Doc from org. Same as
| |
| tap | back to summary |
|---|---|
| public MutableSet Implements 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()));
| |
| toImmutable | back to summary |
|---|---|
| public ImmutableSet Implements org. Doc from org. Returns an immutable copy of this set. If the set is immutable, it returns itself.
| |
| union | back to summary |
|---|---|
| public MutableSet Implements org. Doc from org. Returns the set of all objects that are a member of
| |
| unionInto | back to summary |
|---|---|
| public <R extends Set Implements org. Doc from org. Same as
| |
| zip | back to summary |
|---|---|
| public <S> MutableSet Implements org. Doc from org. Deprecated in 6.0. Use Returns a
| |
| zipWithIndex | back to summary |
|---|---|
| public MutableSet Implements org. Doc from org. Deprecated in 6.0. Use Zips this
| |