All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.collections.api.set.ImmutableSet Maven / Gradle / Ivy

There is a newer version: 12.0.0.M3
Show newest version
/*
 * Copyright (c) 2018 Goldman Sachs and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * and Eclipse Distribution License v. 1.0 which accompany this distribution.
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
 * and the Eclipse Distribution License is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 */

package org.eclipse.collections.api.set;

import java.util.Set;

import org.eclipse.collections.api.block.function.Function;
import org.eclipse.collections.api.block.function.Function2;
import org.eclipse.collections.api.block.function.primitive.BooleanFunction;
import org.eclipse.collections.api.block.function.primitive.ByteFunction;
import org.eclipse.collections.api.block.function.primitive.CharFunction;
import org.eclipse.collections.api.block.function.primitive.DoubleFunction;
import org.eclipse.collections.api.block.function.primitive.FloatFunction;
import org.eclipse.collections.api.block.function.primitive.IntFunction;
import org.eclipse.collections.api.block.function.primitive.LongFunction;
import org.eclipse.collections.api.block.function.primitive.ShortFunction;
import org.eclipse.collections.api.block.predicate.Predicate;
import org.eclipse.collections.api.block.predicate.Predicate2;
import org.eclipse.collections.api.block.procedure.Procedure;
import org.eclipse.collections.api.multimap.set.ImmutableSetMultimap;
import org.eclipse.collections.api.ordered.OrderedIterable;
import org.eclipse.collections.api.partition.set.PartitionImmutableSet;
import org.eclipse.collections.api.set.primitive.ImmutableBooleanSet;
import org.eclipse.collections.api.set.primitive.ImmutableByteSet;
import org.eclipse.collections.api.set.primitive.ImmutableCharSet;
import org.eclipse.collections.api.set.primitive.ImmutableDoubleSet;
import org.eclipse.collections.api.set.primitive.ImmutableFloatSet;
import org.eclipse.collections.api.set.primitive.ImmutableIntSet;
import org.eclipse.collections.api.set.primitive.ImmutableLongSet;
import org.eclipse.collections.api.set.primitive.ImmutableShortSet;
import org.eclipse.collections.api.tuple.Pair;

/**
 * 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.
 */
public interface ImmutableSet
        extends UnsortedSetIterable, ImmutableSetIterable
{
    @Override
    ImmutableSet newWith(T element);

    @Override
    ImmutableSet newWithout(T element);

    @Override
    ImmutableSet newWithAll(Iterable elements);

    @Override
    ImmutableSet newWithoutAll(Iterable elements);

    @Override
    ImmutableSet tap(Procedure procedure);

    @Override
    ImmutableSet select(Predicate predicate);

    @Override
    

ImmutableSet selectWith(Predicate2 predicate, P parameter); @Override ImmutableSet reject(Predicate predicate); @Override

ImmutableSet rejectWith(Predicate2 predicate, P parameter); @Override PartitionImmutableSet partition(Predicate predicate); @Override

PartitionImmutableSet partitionWith(Predicate2 predicate, P parameter); @Override ImmutableSet selectInstancesOf(Class clazz); @Override ImmutableSet collect(Function function); @Override ImmutableBooleanSet collectBoolean(BooleanFunction booleanFunction); @Override ImmutableByteSet collectByte(ByteFunction byteFunction); @Override ImmutableCharSet collectChar(CharFunction charFunction); @Override ImmutableDoubleSet collectDouble(DoubleFunction doubleFunction); @Override ImmutableFloatSet collectFloat(FloatFunction floatFunction); @Override ImmutableIntSet collectInt(IntFunction intFunction); @Override ImmutableLongSet collectLong(LongFunction longFunction); @Override ImmutableShortSet collectShort(ShortFunction shortFunction); @Override ImmutableSet collectWith(Function2 function, P parameter); @Override ImmutableSet collectIf(Predicate predicate, Function function); @Override ImmutableSet flatCollect(Function> function); /** * @since 9.2 */ @Override default ImmutableSet flatCollectWith(Function2> function, P parameter) { return this.flatCollect(each -> function.apply(each, parameter)); } @Override ImmutableSetMultimap groupBy(Function function); @Override ImmutableSetMultimap groupByEach(Function> function); /** * @deprecated in 6.0. Use {@link OrderedIterable#zip(Iterable)} instead. */ @Override @Deprecated ImmutableSet> zip(Iterable that); /** * @deprecated in 6.0. Use {@link OrderedIterable#zipWithIndex()} instead. */ @Override @Deprecated ImmutableSet> zipWithIndex(); Set castToSet(); @Override ImmutableSet union(SetIterable set); @Override ImmutableSet intersect(SetIterable set); @Override ImmutableSet difference(SetIterable subtrahendSet); @Override ImmutableSet symmetricDifference(SetIterable setB); @Override ImmutableSet> powerSet(); }