InternalIterable<T>, java.lang.Iterable<T>, RichIterable<T>FixedSizeSet<T>, ImmutableSet<T>, ImmutableSetIterable<T>, ImmutableSortedSet<T>, MutableSet<T>, MutableSetIterable<T>, MutableSortedSet<T>, SortedSetIterable<T>, UnsortedSetIterable<T>AbstractImmutableSet, AbstractMutableSet, AbstractUnifiedSet, MultiReaderUnifiedSet, SetAdapter, SortedSetAdapter, SynchronizedMutableSet, SynchronizedSortedSet, TreeSortedSet, UnifiedSet, UnifiedSetWithHashingStrategy, UnmodifiableMutableSet, UnmodifiableSortedSetpublic interface SetIterable<T> extends RichIterable<T>
| Modifier and Type | Method | Description |
|---|---|---|
ParallelSetIterable<T> |
asParallel(java.util.concurrent.ExecutorService executorService,
int batchSize) |
Returns a parallel iterable of this SetIterable.
|
<B> LazyIterable<Pair<T,B>> |
cartesianProduct(SetIterable<B> set) |
Returns the set whose members are all possible ordered pairs (a, b) where a is a member of
this and b is a
member of set. |
SetIterable<T> |
difference(SetIterable<? extends T> subtrahendSet) |
Returns the set of all members of
this that are not members of subtrahendSet. |
<R extends java.util.Set<T>> |
differenceInto(SetIterable<? extends T> subtrahendSet,
R targetSet) |
Same as
difference(SetIterable) but adds all the objects to targetSet and returns it. |
boolean |
equals(java.lang.Object o) |
Follows the same general contract as
Set.equals(Object). |
int |
hashCode() |
Follows the same general contract as
Set.hashCode(). |
SetIterable<T> |
intersect(SetIterable<? extends T> set) |
Returns the set of all objects that are members of both
this and set. |
<R extends java.util.Set<T>> |
intersectInto(SetIterable<? extends T> set,
R targetSet) |
Same as
intersect(SetIterable) but adds all the objects to targetSet and returns it. |
boolean |
isProperSubsetOf(SetIterable<? extends T> candidateSuperset) |
Returns true if all the members of
this are also members of candidateSuperset and the
two sets are not equal. |
boolean |
isSubsetOf(SetIterable<? extends T> candidateSuperset) |
Returns true if all the members of
this are also members of candidateSuperset. |
PartitionSet<T> |
partition(Predicate<? super T> predicate) |
Filters a collection into a PartitionedIterable based on the evaluation of the predicate.
|
<P> PartitionSet<T> |
partitionWith(Predicate2<? super T,? super P> predicate,
P parameter) |
Filters a collection into a PartitionIterable based on the evaluation of the predicate.
|
SetIterable<T> |
reject(Predicate<? super T> predicate) |
Returns all elements of the source collection that return false when evaluating of the predicate.
|
<P> SetIterable<T> |
rejectWith(Predicate2<? super T,? super P> predicate,
P parameter) |
Similar to
RichIterable.reject(Predicate), except with an evaluation parameter for the second generic argument in Predicate2. |
SetIterable<T> |
select(Predicate<? super T> predicate) |
Returns all elements of the source collection that return true when evaluating the predicate.
|
<S> SetIterable<S> |
selectInstancesOf(java.lang.Class<S> clazz) |
Returns all elements of the source collection that are instances of the Class
clazz. |
<P> SetIterable<T> |
selectWith(Predicate2<? super T,? super P> predicate,
P parameter) |
Similar to
RichIterable.select(Predicate), except with an evaluation parameter for the second generic argument in Predicate2. |
SetIterable<T> |
symmetricDifference(SetIterable<? extends T> setB) |
Returns the set of all objects that are a member of exactly one of
this and setB (elements which
are in one of the sets, but not in both). |
<R extends java.util.Set<T>> |
symmetricDifferenceInto(SetIterable<? extends T> set,
R targetSet) |
Same as
symmetricDifference(SetIterable) but adds all the objects to targetSet and returns it. |
SetIterable<T> |
tap(Procedure<? super T> procedure) |
Executes the Procedure for each element in the iterable and returns
this. |
ImmutableSetIterable<T> |
toImmutable() |
|
SetIterable<T> |
union(SetIterable<? extends T> set) |
Returns the set of all objects that are a member of
this or set or both. |
<R extends java.util.Set<T>> |
unionInto(SetIterable<? extends T> set,
R targetSet) |
Same as
union(SetIterable) but adds all the objects to targetSet and returns it. |
SetIterable<Pair<T,java.lang.Integer>> |
zipWithIndex() |
Deprecated.
in 6.0. Use
OrderedIterable.zipWithIndex() instead. |
forEach, forEach, forEachWith, forEachWithIndexaggregateBy, aggregateInPlaceBy, 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, countBy, countByWith, countByWith, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, flatCollect, flatCollect, getFirst, getLast, getOnly, groupBy, groupBy, groupByEach, groupByEach, groupByUniqueKey, 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, reduce, reduceInPlace, reduceInPlace, reject, rejectWith, select, selectWith, size, sumByDouble, sumByFloat, sumByInt, sumByLong, 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, toString, zip, zip, zipWithIndexSetIterable<T> union(SetIterable<? extends T> set)
this or set or both. The union of [1, 2, 3]
and [2, 3, 4] is the set [1, 2, 3, 4]. If equal elements appear in both sets, then the output will contain the
copy from this.<R extends java.util.Set<T>> R unionInto(SetIterable<? extends T> set, R targetSet)
union(SetIterable) but adds all the objects to targetSet and returns it.SetIterable<T> intersect(SetIterable<? extends T> set)
this and set. The intersection of
[1, 2, 3] and [2, 3, 4] is the set [2, 3]. The output will contain instances from this, not set.<R extends java.util.Set<T>> R intersectInto(SetIterable<? extends T> set, R targetSet)
intersect(SetIterable) but adds all the objects to targetSet and returns it.SetIterable<T> difference(SetIterable<? extends T> subtrahendSet)
this that are not members of subtrahendSet. The difference of
[1, 2, 3] and [2, 3, 4] is [1].<R extends java.util.Set<T>> R differenceInto(SetIterable<? extends T> subtrahendSet, R targetSet)
difference(SetIterable) but adds all the objects to targetSet and returns it.SetIterable<T> symmetricDifference(SetIterable<? extends T> setB)
this and setB (elements which
are in one of the sets, but not in both). For instance, for the sets [1, 2, 3] and [2, 3, 4], the symmetric
difference set is [1, 4] . It is the set difference of the union and the intersection.<R extends java.util.Set<T>> R symmetricDifferenceInto(SetIterable<? extends T> set, R targetSet)
symmetricDifference(SetIterable) but adds all the objects to targetSet and returns it.boolean isSubsetOf(SetIterable<? extends T> candidateSuperset)
this are also members of candidateSuperset.
For example, [1, 2] is a subset of [1, 2, 3], but [1, 4] is not.boolean isProperSubsetOf(SetIterable<? extends T> candidateSuperset)
this are also members of candidateSuperset and the
two sets are not equal. For example, [1, 2] is a proper subset of [1, 2, 3], but [1, 2, 3] is not.<B> LazyIterable<Pair<T,B>> cartesianProduct(SetIterable<B> set)
this and b is a
member of set.SetIterable<T> tap(Procedure<? super T> procedure)
RichIterablethis.
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 RichIterable<T>RichIterable.each(Procedure),
InternalIterable.forEach(Procedure)SetIterable<T> select(Predicate<? super T> predicate)
RichIterableExample 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<T><P> SetIterable<T> selectWith(Predicate2<? super T,? super P> predicate, P parameter)
RichIterableRichIterable.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<T>predicate - a Predicate2 to use as the select criteriaparameter - a parameter to pass in for evaluation of the second argument P in predicateRichIterable.select(Predicate)SetIterable<T> reject(Predicate<? super T> predicate)
RichIterableExample 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<T>predicate - a Predicate to use as the reject criteriaPredicate.accept(Object) method to evaluate to false<P> SetIterable<T> rejectWith(Predicate2<? super T,? super P> predicate, P parameter)
RichIterableRichIterable.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 RichIterable<T>predicate - a Predicate2 to use as the select criteriaparameter - a parameter to pass in for evaluation of the second argument P in predicateRichIterable.select(Predicate)PartitionSet<T> partition(Predicate<? super T> predicate)
RichIterableExample 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 RichIterable<T><P> PartitionSet<T> partitionWith(Predicate2<? super T,? super P> predicate, P parameter)
RichIterableExample using a Java 8 lambda expression:
PartitionIterable<Person>> newYorkersAndNonNewYorkers =
people.partitionWith((Person person, String state) -> person.getAddress().getState().getName().equals(state), "New York");
Example using an anonymous inner class:
PartitionIterable<Person>> newYorkersAndNonNewYorkers =
people.partitionWith(new Predicate2<Person, String>()
{
public boolean accept(Person person, String state)
{
return person.getAddress().getState().getName().equals(state);
}
}, "New York");
partitionWith in interface RichIterable<T><S> SetIterable<S> selectInstancesOf(java.lang.Class<S> clazz)
RichIterableclazz.
RichIterable<Integer> integers =
List.mutable.with(new Integer(0), new Long(0L), new Double(0.0)).selectInstancesOf(Integer.class);
selectInstancesOf in interface RichIterable<T>@Deprecated SetIterable<Pair<T,java.lang.Integer>> zipWithIndex()
OrderedIterable.zipWithIndex() instead.RichIterableRichIterable with its indices.zipWithIndex in interface RichIterable<T>RichIterable containing pairs consisting of all elements of this RichIterable
paired with their index. Indices start at 0.RichIterable.zip(Iterable)ParallelSetIterable<T> asParallel(java.util.concurrent.ExecutorService executorService, int batchSize)
boolean equals(java.lang.Object o)
Set.equals(Object).equals in class java.lang.Objectint hashCode()
Set.hashCode().hashCode in class java.lang.ObjectImmutableSetIterable<T> toImmutable()
Copyright © 2004–2018. All rights reserved.