![JAR search and dependency download from the Maven repository](/logo.png)
com.gs.collections.api.set.ImmutableSet Maven / Gradle / Ivy
/*
* Copyright 2015 Goldman Sachs.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.gs.collections.api.set;
import java.util.Set;
import com.gs.collections.api.block.function.Function;
import com.gs.collections.api.block.function.Function2;
import com.gs.collections.api.block.function.primitive.BooleanFunction;
import com.gs.collections.api.block.function.primitive.ByteFunction;
import com.gs.collections.api.block.function.primitive.CharFunction;
import com.gs.collections.api.block.function.primitive.DoubleFunction;
import com.gs.collections.api.block.function.primitive.FloatFunction;
import com.gs.collections.api.block.function.primitive.IntFunction;
import com.gs.collections.api.block.function.primitive.LongFunction;
import com.gs.collections.api.block.function.primitive.ShortFunction;
import com.gs.collections.api.block.predicate.Predicate;
import com.gs.collections.api.block.predicate.Predicate2;
import com.gs.collections.api.block.procedure.Procedure;
import com.gs.collections.api.multimap.set.ImmutableSetMultimap;
import com.gs.collections.api.ordered.OrderedIterable;
import com.gs.collections.api.partition.set.PartitionImmutableSet;
import com.gs.collections.api.set.primitive.ImmutableBooleanSet;
import com.gs.collections.api.set.primitive.ImmutableByteSet;
import com.gs.collections.api.set.primitive.ImmutableCharSet;
import com.gs.collections.api.set.primitive.ImmutableDoubleSet;
import com.gs.collections.api.set.primitive.ImmutableFloatSet;
import com.gs.collections.api.set.primitive.ImmutableIntSet;
import com.gs.collections.api.set.primitive.ImmutableLongSet;
import com.gs.collections.api.set.primitive.ImmutableShortSet;
import com.gs.collections.api.tuple.Pair;
import net.jcip.annotations.Immutable;
/**
* ImmutableSet is the non-modifiable equivalent interface to {@link MutableSet}. {@link MutableSet#toImmutable()} will
* give you an appropriately trimmed implementation of ImmutableSet. All ImmutableSet implementations must implement
* the java.util.Set interface so they can satisfy the equals() contract and be compared against other set structures
* like UnifiedSet or HashSet.
*/
@Immutable
public interface ImmutableSet
extends UnsortedSetIterable, ImmutableSetIterable
{
ImmutableSet newWith(T element);
ImmutableSet newWithout(T element);
ImmutableSet newWithAll(Iterable extends T> elements);
ImmutableSet newWithoutAll(Iterable extends T> elements);
ImmutableSet tap(Procedure super T> procedure);
ImmutableSet select(Predicate super T> predicate);
ImmutableSet selectWith(Predicate2 super T, ? super P> predicate, P parameter);
ImmutableSet reject(Predicate super T> predicate);
ImmutableSet rejectWith(Predicate2 super T, ? super P> predicate, P parameter);
PartitionImmutableSet partition(Predicate super T> predicate);
PartitionImmutableSet partitionWith(Predicate2 super T, ? super P> predicate, P parameter);
ImmutableSet selectInstancesOf(Class clazz);
ImmutableSet collect(Function super T, ? extends V> function);
ImmutableBooleanSet collectBoolean(BooleanFunction super T> booleanFunction);
ImmutableByteSet collectByte(ByteFunction super T> byteFunction);
ImmutableCharSet collectChar(CharFunction super T> charFunction);
ImmutableDoubleSet collectDouble(DoubleFunction super T> doubleFunction);
ImmutableFloatSet collectFloat(FloatFunction super T> floatFunction);
ImmutableIntSet collectInt(IntFunction super T> intFunction);
ImmutableLongSet collectLong(LongFunction super T> longFunction);
ImmutableShortSet collectShort(ShortFunction super T> shortFunction);
ImmutableSet collectWith(Function2 super T, ? super P, ? extends V> function, P parameter);
ImmutableSet collectIf(Predicate super T> predicate, Function super T, ? extends V> function);
ImmutableSet flatCollect(Function super T, ? extends Iterable> function);
ImmutableSetMultimap groupBy(Function super T, ? extends V> function);
ImmutableSetMultimap groupByEach(Function super T, ? extends Iterable> function);
/**
* @deprecated in 6.0. Use {@link OrderedIterable#zip(Iterable)} instead.
*/
@Deprecated
ImmutableSet> zip(Iterable that);
/**
* @deprecated in 6.0. Use {@link OrderedIterable#zipWithIndex()} instead.
*/
@Deprecated
ImmutableSet> zipWithIndex();
Set castToSet();
ImmutableSet union(SetIterable extends T> set);
ImmutableSet intersect(SetIterable extends T> set);
ImmutableSet difference(SetIterable extends T> subtrahendSet);
ImmutableSet symmetricDifference(SetIterable extends T> setB);
ImmutableSet> powerSet();
}