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

com.gs.collections.api.list.ImmutableList 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.list;

import java.util.List;

import com.gs.collections.api.block.HashingStrategy;
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.collection.ImmutableCollection;
import com.gs.collections.api.list.primitive.ImmutableBooleanList;
import com.gs.collections.api.list.primitive.ImmutableByteList;
import com.gs.collections.api.list.primitive.ImmutableCharList;
import com.gs.collections.api.list.primitive.ImmutableDoubleList;
import com.gs.collections.api.list.primitive.ImmutableFloatList;
import com.gs.collections.api.list.primitive.ImmutableIntList;
import com.gs.collections.api.list.primitive.ImmutableLongList;
import com.gs.collections.api.list.primitive.ImmutableShortList;
import com.gs.collections.api.multimap.list.ImmutableListMultimap;
import com.gs.collections.api.partition.list.PartitionImmutableList;
import com.gs.collections.api.tuple.Pair;
import net.jcip.annotations.Immutable;

/**
 * ImmutableList is the non-modifiable equivalent interface to {@link MutableList}. {@link MutableList#toImmutable()}
 * will give you an appropriately trimmed implementation of ImmutableList.  All ImmutableList implementations must
 * implement the java.util.List interface so they can satisfy the equals() contract and be compared against other list
 * structures like FastList or ArrayList.
 */
@Immutable
public interface ImmutableList
        extends ImmutableCollection, ListIterable
{
    ImmutableList newWith(T element);

    ImmutableList newWithout(T element);

    ImmutableList newWithAll(Iterable elements);

    ImmutableList newWithoutAll(Iterable elements);

    ImmutableList tap(Procedure procedure);

    ImmutableList select(Predicate predicate);

    

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

ImmutableList rejectWith(Predicate2 predicate, P parameter); PartitionImmutableList partition(Predicate predicate);

PartitionImmutableList partitionWith(Predicate2 predicate, P parameter); ImmutableList selectInstancesOf(Class clazz); ImmutableList collect(Function function); ImmutableBooleanList collectBoolean(BooleanFunction booleanFunction); ImmutableByteList collectByte(ByteFunction byteFunction); ImmutableCharList collectChar(CharFunction charFunction); ImmutableDoubleList collectDouble(DoubleFunction doubleFunction); ImmutableFloatList collectFloat(FloatFunction floatFunction); ImmutableIntList collectInt(IntFunction intFunction); ImmutableLongList collectLong(LongFunction longFunction); ImmutableShortList collectShort(ShortFunction shortFunction); ImmutableList collectWith(Function2 function, P parameter); ImmutableList collectIf(Predicate predicate, Function function); ImmutableList flatCollect(Function> function); ImmutableListMultimap groupBy(Function function); ImmutableListMultimap groupByEach(Function> function); ImmutableList distinct(); ImmutableList distinct(HashingStrategy hashingStrategy); ImmutableList> zip(Iterable that); ImmutableList> zipWithIndex(); ImmutableList take(int count); ImmutableList takeWhile(Predicate predicate); ImmutableList drop(int count); ImmutableList dropWhile(Predicate predicate); PartitionImmutableList partitionWhile(Predicate predicate); List castToList(); /** * @see List#subList(int, int) * @since 6.0 */ ImmutableList subList(int fromIndex, int toIndex); ImmutableList toReversed(); }