public interface SetIterable<T> extends RichIterable<T>
| Modifier and Type | Method and Description |
|---|---|
<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 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(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 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(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 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> |
union(SetIterable<? extends T> set)
Returns the set of all objects that are a member of
this or set or both. |
<R extends 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,Integer>> |
zipWithIndex()
Zips this
RichIterable with its indices. |
aggregateBy, 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, countWith, detect, detectIfNone, detectWith, detectWithIfNone, flatCollect, flatCollect, getFirst, getLast, groupBy, groupBy, groupByEach, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, isEmpty, makeString, makeString, makeString, max, max, maxBy, min, min, minBy, noneSatisfy, noneSatisfyWith, notEmpty, reject, rejectWith, select, selectWith, size, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toList, toMap, toSet, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toSortedSetBy, toString, zip, zip, zipWithIndexforEach, forEachWith, forEachWithIndexforEach, iterator, spliteratorSetIterable<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 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 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 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 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> select(Predicate<? super T> predicate)
RichIterablee.g.
return people.select(new Predicate<Person>()
{
public boolean accept(Person person)
{
return person.getAddress().getCity().equals("Metuchen");
}
});
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.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)
RichIterablee.g.
return people.reject(new Predicate<Person>()
{
public boolean accept(Person person)
{
return person.person.getLastName().equals("Smith");
}
});
e.g.
return people.reject(Predicates.attributeEqual("lastName", "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.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)
RichIterablee.g.
return 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)
RichIterablee.g.
return 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(Class<S> clazz)
RichIterableclazz.selectInstancesOf in interface RichIterable<T>SetIterable<Pair<T,Integer>> zipWithIndex()
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)boolean equals(Object o)
Set.equals(Object).int hashCode()
Set.hashCode().Copyright © 2004–2017. All rights reserved.