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

com.gs.collections.api.bag.ImmutableBag 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.bag;

import com.gs.collections.api.bag.primitive.ImmutableBooleanBag;
import com.gs.collections.api.bag.primitive.ImmutableByteBag;
import com.gs.collections.api.bag.primitive.ImmutableCharBag;
import com.gs.collections.api.bag.primitive.ImmutableDoubleBag;
import com.gs.collections.api.bag.primitive.ImmutableFloatBag;
import com.gs.collections.api.bag.primitive.ImmutableIntBag;
import com.gs.collections.api.bag.primitive.ImmutableLongBag;
import com.gs.collections.api.bag.primitive.ImmutableShortBag;
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.predicate.primitive.IntPredicate;
import com.gs.collections.api.block.procedure.Procedure;
import com.gs.collections.api.list.ImmutableList;
import com.gs.collections.api.multimap.bag.ImmutableBagMultimap;
import com.gs.collections.api.ordered.OrderedIterable;
import com.gs.collections.api.partition.bag.PartitionImmutableBag;
import com.gs.collections.api.set.ImmutableSet;
import com.gs.collections.api.tuple.Pair;
import com.gs.collections.api.tuple.primitive.ObjectIntPair;

/**
 * @since 1.0
 */
public interface ImmutableBag extends UnsortedBag, ImmutableBagIterable
{
    ImmutableBag newWith(T element);

    ImmutableBag newWithout(T element);

    ImmutableBag newWithAll(Iterable elements);

    ImmutableBag newWithoutAll(Iterable elements);

    ImmutableBag selectByOccurrences(IntPredicate predicate);

    ImmutableBag tap(Procedure procedure);

    ImmutableBag select(Predicate predicate);

    

ImmutableBag selectWith(Predicate2 predicate, P parameter); ImmutableBag reject(Predicate predicate);

ImmutableBag rejectWith(Predicate2 predicate, P parameter); PartitionImmutableBag partition(Predicate predicate);

PartitionImmutableBag partitionWith(Predicate2 predicate, P parameter); ImmutableBag selectInstancesOf(Class clazz); ImmutableBag collect(Function function); ImmutableBooleanBag collectBoolean(BooleanFunction booleanFunction); ImmutableByteBag collectByte(ByteFunction byteFunction); ImmutableCharBag collectChar(CharFunction charFunction); ImmutableDoubleBag collectDouble(DoubleFunction doubleFunction); ImmutableFloatBag collectFloat(FloatFunction floatFunction); ImmutableIntBag collectInt(IntFunction intFunction); ImmutableLongBag collectLong(LongFunction longFunction); ImmutableShortBag collectShort(ShortFunction shortFunction); ImmutableBag collectWith(Function2 function, P parameter); ImmutableBag collectIf(Predicate predicate, Function function); ImmutableBag flatCollect(Function> function); ImmutableBagMultimap groupBy(Function function); ImmutableBagMultimap groupByEach(Function> function); /** * @deprecated in 6.0. Use {@link OrderedIterable#zip(Iterable)} instead. */ @Deprecated ImmutableBag> zip(Iterable that); /** * @deprecated in 6.0. Use {@link OrderedIterable#zipWithIndex()} instead. */ @Deprecated ImmutableSet> zipWithIndex(); /** * @since 6.0 */ ImmutableList> topOccurrences(int count); /** * @since 6.0 */ ImmutableList> bottomOccurrences(int count); }