com.gs.collections.api.collection.ImmutableCollection Maven / Gradle / Ivy
/*
* Copyright 2014 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.collection;
import com.gs.collections.api.RichIterable;
import com.gs.collections.api.block.function.Function;
import com.gs.collections.api.block.function.Function0;
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.block.procedure.Procedure2;
import com.gs.collections.api.collection.primitive.ImmutableBooleanCollection;
import com.gs.collections.api.collection.primitive.ImmutableByteCollection;
import com.gs.collections.api.collection.primitive.ImmutableCharCollection;
import com.gs.collections.api.collection.primitive.ImmutableDoubleCollection;
import com.gs.collections.api.collection.primitive.ImmutableFloatCollection;
import com.gs.collections.api.collection.primitive.ImmutableIntCollection;
import com.gs.collections.api.collection.primitive.ImmutableLongCollection;
import com.gs.collections.api.collection.primitive.ImmutableShortCollection;
import com.gs.collections.api.map.ImmutableMap;
import com.gs.collections.api.multimap.ImmutableMultimap;
import com.gs.collections.api.partition.PartitionImmutableCollection;
import com.gs.collections.api.tuple.Pair;
import net.jcip.annotations.Immutable;
/**
* ImmutableCollection is the common interface between ImmutableList and ImmutableSet.
*/
@Immutable
public interface ImmutableCollection
extends RichIterable
{
ImmutableCollection newWith(T element);
ImmutableCollection newWithout(T element);
ImmutableCollection newWithAll(Iterable extends T> elements);
ImmutableCollection newWithoutAll(Iterable extends T> elements);
ImmutableCollection tap(Procedure super T> procedure);
ImmutableCollection select(Predicate super T> predicate);
ImmutableCollection selectWith(Predicate2 super T, ? super P> predicate, P parameter);
ImmutableCollection reject(Predicate super T> predicate);
ImmutableCollection rejectWith(Predicate2 super T, ? super P> predicate, P parameter);
PartitionImmutableCollection partition(Predicate super T> predicate);
PartitionImmutableCollection partitionWith(Predicate2 super T, ? super P> predicate, P parameter);
ImmutableCollection selectInstancesOf(Class clazz);
ImmutableCollection collect(Function super T, ? extends V> function);
ImmutableBooleanCollection collectBoolean(BooleanFunction super T> booleanFunction);
ImmutableByteCollection collectByte(ByteFunction super T> byteFunction);
ImmutableCharCollection collectChar(CharFunction super T> charFunction);
ImmutableDoubleCollection collectDouble(DoubleFunction super T> doubleFunction);
ImmutableFloatCollection collectFloat(FloatFunction super T> floatFunction);
ImmutableIntCollection collectInt(IntFunction super T> intFunction);
ImmutableLongCollection collectLong(LongFunction super T> longFunction);
ImmutableShortCollection collectShort(ShortFunction super T> shortFunction);
ImmutableCollection collectWith(Function2 super T, ? super P, ? extends V> function, P parameter);
ImmutableCollection collectIf(Predicate super T> predicate, Function super T, ? extends V> function);
ImmutableCollection flatCollect(Function super T, ? extends Iterable> function);
ImmutableMultimap groupBy(Function super T, ? extends V> function);
ImmutableMultimap groupByEach(Function super T, ? extends Iterable> function);
ImmutableMap groupByUniqueKey(Function super T, ? extends V> function);
ImmutableCollection> zip(Iterable that);
ImmutableCollection> zipWithIndex();
ImmutableMap aggregateInPlaceBy(
Function super T, ? extends K> groupBy,
Function0 extends V> zeroValueFactory,
Procedure2 super V, ? super T> mutatingAggregator);
ImmutableMap aggregateBy(
Function super T, ? extends K> groupBy,
Function0 extends V> zeroValueFactory,
Function2 super V, ? super T, ? extends V> nonMutatingAggregator);
}