Top Methods
org.eclipse.collections.api.set

public Interface ImmutableSetIterable<T>

extends SetIterable<T>, ImmutableCollection<T>
Known Direct Subinterfaces
org.eclipse.collections.api.set.sorted.ImmutableSortedSet, org.eclipse.collections.api.set.ImmutableSet
Imports
org.eclipse.collections.api.block.function.Function, org.eclipse.collections.api.block.predicate.Predicate, .Predicate2, org.eclipse.collections.api.block.procedure.Procedure, org.eclipse.collections.api.collection.ImmutableCollection, org.eclipse.collections.api.multimap.set.ImmutableSetIterableMultimap, org.eclipse.collections.api.ordered.OrderedIterable, org.eclipse.collections.api.partition.set.PartitionImmutableSetIterable, org.eclipse.collections.api.tuple.Pair

Since
6.0

Method Summary

Modifier and TypeMethod and Description
public <V> ImmutableSetIterableMultimap<V, T>
groupBy(Function<? super T, ? extends V> function)

Redeclares org.eclipse.collections.api.RichIterable.groupBy, org.eclipse.collections.api.collection.ImmutableCollection.groupBy.

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> ImmutableSetIterableMultimap<V, T>
groupByEach(Function<? super T, ? extends Iterable<V>> function)

Redeclares org.eclipse.collections.api.RichIterable.groupByEach, org.eclipse.collections.api.collection.ImmutableCollection.groupByEach.

Similar to groupBy(Function), except the result of evaluating function will return a collection of keys for each value.

public PartitionImmutableSetIterable<T>
partition(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.set.SetIterable.partition, org.eclipse.collections.api.collection.ImmutableCollection.partition.

Filters a collection into a PartitionedIterable based on the evaluation of the predicate.

public <P> PartitionImmutableSetIterable<T>
partitionWith(Predicate2<? super T, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.set.SetIterable.partitionWith, org.eclipse.collections.api.collection.ImmutableCollection.partitionWith.

Filters a collection into a PartitionIterable based on the evaluation of the predicate.

public ImmutableSetIterable<T>
reject(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.set.SetIterable.reject, org.eclipse.collections.api.collection.ImmutableCollection.reject.

Returns all elements of the source collection that return false when evaluating of the predicate.

public <P> ImmutableSetIterable<T>
rejectWith(Predicate2<? super T, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.set.SetIterable.rejectWith, org.eclipse.collections.api.collection.ImmutableCollection.rejectWith.

Similar to reject(Predicate), except with an evaluation parameter for the second generic argument in Predicate2.

public ImmutableSetIterable<T>
select(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.set.SetIterable.select, org.eclipse.collections.api.collection.ImmutableCollection.select.

Returns all elements of the source collection that return true when evaluating the predicate.

public <S> ImmutableSetIterable<S>
selectInstancesOf(Class<S> clazz)

Redeclares org.eclipse.collections.api.set.SetIterable.selectInstancesOf, org.eclipse.collections.api.collection.ImmutableCollection.selectInstancesOf.

Returns all elements of the source collection that are instances of the Class clazz.

public <P> ImmutableSetIterable<T>
selectWith(Predicate2<? super T, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.set.SetIterable.selectWith, org.eclipse.collections.api.collection.ImmutableCollection.selectWith.

Similar to select(Predicate), except with an evaluation parameter for the second generic argument in Predicate2.

public ImmutableSetIterable<T>
tap(Procedure<? super T> procedure)

Redeclares org.eclipse.collections.api.set.SetIterable.tap, org.eclipse.collections.api.collection.ImmutableCollection.tap.

Executes the Procedure for each element in the iterable and returns this.

public ImmutableSetIterable<Pair<T, Integer>>
Inherited from org.eclipse.collections.api.collection.ImmutableCollection:
aggregateByaggregateInPlaceBycastToCollectioncollectcollectBooleancollectBytecollectCharcollectDoublecollectFloatcollectIfcollectIntcollectLongcollectShortcollectWithcountBycountByEachcountByWithflatCollectflatCollectWithgroupByUniqueKeynewWithnewWithAllnewWithoutnewWithoutAllparallelStreamreduceByspliteratorstreamsumByDoublesumByFloatsumByIntsumByLongzip
Inherited from org.eclipse.collections.api.set.SetIterable:
asParallelcartesianProductdifferencedifferenceIntoequalshashCodeintersectintersectIntoisProperSubsetOfisSubsetOfsymmetricDifferencesymmetricDifferenceIntotoImmutableunionunionInto

Method Detail

groupByback to summary
public <V> ImmutableSetIterableMultimap<V, T> groupBy(Function<? super T, ? extends V> function)

Redeclares org.eclipse.collections.api.RichIterable.groupBy, org.eclipse.collections.api.collection.ImmutableCollection.groupBy.

Doc from org.eclipse.collections.api.RichIterable.groupBy.

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);
Annotations
@Override
groupByEachback to summary
public <V> ImmutableSetIterableMultimap<V, T> groupByEach(Function<? super T, ? extends Iterable<V>> function)

Redeclares org.eclipse.collections.api.RichIterable.groupByEach, org.eclipse.collections.api.collection.ImmutableCollection.groupByEach.

Doc from org.eclipse.collections.api.RichIterable.groupByEach.

Similar to groupBy(Function), except the result of evaluating function will return a collection of keys for each value.

Annotations
@Override
partitionback to summary
public PartitionImmutableSetIterable<T> partition(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.set.SetIterable.partition, org.eclipse.collections.api.collection.ImmutableCollection.partition.

Doc from org.eclipse.collections.api.RichIterable.partition.

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"));
Annotations
@Override
partitionWithback to summary
public <P> PartitionImmutableSetIterable<T> partitionWith(Predicate2<? super T, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.set.SetIterable.partitionWith, org.eclipse.collections.api.collection.ImmutableCollection.partitionWith.

Doc from org.eclipse.collections.api.RichIterable.partitionWith.

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");
Annotations
@Override
rejectback to summary
public ImmutableSetIterable<T> reject(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.set.SetIterable.reject, org.eclipse.collections.api.collection.ImmutableCollection.reject.

Doc from org.eclipse.collections.api.RichIterable.reject.

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"));
Annotations
@Override
rejectWithback to summary
public <P> ImmutableSetIterable<T> rejectWith(Predicate2<? super T, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.set.SetIterable.rejectWith, org.eclipse.collections.api.collection.ImmutableCollection.rejectWith.

Doc from org.eclipse.collections.api.RichIterable.rejectWith.

Similar to 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));
Annotations
@Override
selectback to summary
public ImmutableSetIterable<T> select(Predicate<? super T> predicate)

Redeclares org.eclipse.collections.api.set.SetIterable.select, org.eclipse.collections.api.collection.ImmutableCollection.select.

Doc from org.eclipse.collections.api.RichIterable.select.

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"));
Annotations
@Override
selectInstancesOfback to summary
public <S> ImmutableSetIterable<S> selectInstancesOf(Class<S> clazz)

Redeclares org.eclipse.collections.api.set.SetIterable.selectInstancesOf, org.eclipse.collections.api.collection.ImmutableCollection.selectInstancesOf.

Doc from org.eclipse.collections.api.RichIterable.selectInstancesOf.

Returns all elements of the source collection that are instances of the Class clazz.

RichIterable<Integer> integers =
    List.mutable.with(new Integer(0), new Long(0L), new Double(0.0)).selectInstancesOf(Integer.class);
Annotations
@Override
selectWithback to summary
public <P> ImmutableSetIterable<T> selectWith(Predicate2<? super T, ? super P> predicate, P parameter)

Redeclares org.eclipse.collections.api.set.SetIterable.selectWith, org.eclipse.collections.api.collection.ImmutableCollection.selectWith.

Doc from org.eclipse.collections.api.RichIterable.selectWith.

Similar to 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));
Annotations
@Override
tapback to summary
public ImmutableSetIterable<T> tap(Procedure<? super T> procedure)

Redeclares org.eclipse.collections.api.set.SetIterable.tap, org.eclipse.collections.api.collection.ImmutableCollection.tap.

Doc from org.eclipse.collections.api.RichIterable.tap.

Executes the Procedure for each element in the iterable and returns this.

Example using a Java 8 lambda expression:

RichIterable<Person> tapped =
    people.tap(person -> LOGGER.info(person.getName()));
Annotations
@Override
zipWithIndexback to summary
public ImmutableSetIterable<Pair<T, Integer>> zipWithIndex()

Redeclares org.eclipse.collections.api.set.SetIterable.zipWithIndex, org.eclipse.collections.api.collection.ImmutableCollection.zipWithIndex.

Doc from org.eclipse.collections.api.RichIterable.zipWithIndex.

Deprecated

in 6.0. Use OrderedIterable#zipWithIndex() instead.

Zips this RichIterable with its indices.

Annotations
@Override
@Deprecated