com.gs.collections.api.set.MutableSet Maven / Gradle / Ivy
Show all versions of gs-collections-api Show documentation
/*
* Copyright 2011 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.collection.MutableCollection;
import com.gs.collections.api.multimap.set.MutableSetMultimap;
import com.gs.collections.api.partition.set.PartitionMutableSet;
import com.gs.collections.api.set.primitive.MutableBooleanSet;
import com.gs.collections.api.set.primitive.MutableByteSet;
import com.gs.collections.api.set.primitive.MutableCharSet;
import com.gs.collections.api.set.primitive.MutableDoubleSet;
import com.gs.collections.api.set.primitive.MutableFloatSet;
import com.gs.collections.api.set.primitive.MutableIntSet;
import com.gs.collections.api.set.primitive.MutableLongSet;
import com.gs.collections.api.set.primitive.MutableShortSet;
import com.gs.collections.api.tuple.Pair;
/**
* A MutableSet is an implementation of a JCF Set which provides methods matching the Smalltalk Collection protocol.
*/
public interface MutableSet
extends UnsortedSetIterable, MutableCollection, Set, Cloneable
{
MutableSet with(T element);
MutableSet without(T element);
MutableSet withAll(Iterable extends T> elements);
MutableSet withoutAll(Iterable extends T> elements);
MutableSet newEmpty();
MutableSet clone();
MutableSet select(Predicate super T> predicate);
MutableSet selectWith(Predicate2 super T, ? super P> predicate, P parameter);
MutableSet reject(Predicate super T> predicate);
MutableSet rejectWith(Predicate2 super T, ? super P> predicate, P parameter);
PartitionMutableSet partition(Predicate super T> predicate);
MutableSet selectInstancesOf(Class clazz);
MutableSet collect(Function super T, ? extends V> function);
MutableBooleanSet collectBoolean(BooleanFunction super T> booleanFunction);
MutableByteSet collectByte(ByteFunction super T> byteFunction);
MutableCharSet collectChar(CharFunction super T> charFunction);
MutableDoubleSet collectDouble(DoubleFunction super T> doubleFunction);
MutableFloatSet collectFloat(FloatFunction super T> floatFunction);
MutableIntSet collectInt(IntFunction super T> intFunction);
MutableLongSet collectLong(LongFunction super T> longFunction);
MutableShortSet collectShort(ShortFunction super T> shortFunction);
MutableSet collectWith(Function2 super T, ? super P, ? extends V> function, P parameter);
MutableSet collectIf(Predicate super T> predicate, Function super T, ? extends V> function);
MutableSet flatCollect(Function super T, ? extends Iterable> function);
/**
* Returns an unmodifable view of the set.
* The returned set will be Serializable if this set is Serializable.
*
* @return an unmodifiable view of this set
*/
MutableSet asUnmodifiable();
MutableSet asSynchronized();
/**
* Returns an immutable copy of this set. If the set is immutable, it returns itself.
*
* The returned set will be Serializable if this set is Serializable.
*/
ImmutableSet toImmutable();
MutableSetMultimap groupBy(Function super T, ? extends V> function);
MutableSetMultimap groupByEach(Function super T, ? extends Iterable> function);
MutableSet> zip(Iterable that);
MutableSet> zipWithIndex();
MutableSet union(SetIterable extends T> set);
MutableSet intersect(SetIterable extends T> set);
MutableSet difference(SetIterable extends T> subtrahendSet);
MutableSet symmetricDifference(SetIterable extends T> setB);
MutableSet> powerSet();
}