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

org.eclipse.collections.api.stack.MutableStack Maven / Gradle / Ivy

There is a newer version: 12.0.0.M3
Show newest version
/*
 * Copyright (c) 2015 Goldman Sachs.
 * 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.stack;

import java.util.Collection;

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.list.ListIterable;
import org.eclipse.collections.api.map.MutableMap;
import org.eclipse.collections.api.multimap.list.MutableListMultimap;
import org.eclipse.collections.api.partition.stack.PartitionMutableStack;
import org.eclipse.collections.api.stack.primitive.MutableBooleanStack;
import org.eclipse.collections.api.stack.primitive.MutableByteStack;
import org.eclipse.collections.api.stack.primitive.MutableCharStack;
import org.eclipse.collections.api.stack.primitive.MutableDoubleStack;
import org.eclipse.collections.api.stack.primitive.MutableFloatStack;
import org.eclipse.collections.api.stack.primitive.MutableIntStack;
import org.eclipse.collections.api.stack.primitive.MutableLongStack;
import org.eclipse.collections.api.stack.primitive.MutableShortStack;
import org.eclipse.collections.api.tuple.Pair;

public interface MutableStack extends StackIterable
{
    /**
     * Adds an item to the top of the stack.
     */
    void push(T item);

    /**
     * Removes and returns the top element of the stack.
     */
    T pop();

    /**
     * Removes and returns a ListIterable of the number of elements specified by the count, beginning with the top of the stack.
     */
    ListIterable pop(int count);

    /**
     * Removes and returns a ListIterable of the number of elements specified by the count,
     * beginning with the top of the stack and puts them into the targeted collection type.
     */
    > R pop(int count, R targetCollection);

    /**
     * Removes and returns a ListIterable of the number of elements specified by the count,
     * beginning with the top of the stack and puts them into a new stack.
     */
    > R pop(int count, R targetStack);

    void clear();

    MutableStack asUnmodifiable();

    MutableStack asSynchronized();

    MutableStack tap(Procedure procedure);

    MutableStack select(Predicate predicate);

    

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

MutableStack rejectWith(Predicate2 predicate, P parameter); PartitionMutableStack partition(Predicate predicate);

PartitionMutableStack partitionWith(Predicate2 predicate, P parameter); MutableStack collect(Function function); MutableBooleanStack collectBoolean(BooleanFunction booleanFunction); MutableByteStack collectByte(ByteFunction byteFunction); MutableCharStack collectChar(CharFunction charFunction); MutableDoubleStack collectDouble(DoubleFunction doubleFunction); MutableFloatStack collectFloat(FloatFunction floatFunction); MutableIntStack collectInt(IntFunction intFunction); MutableLongStack collectLong(LongFunction longFunction); MutableShortStack collectShort(ShortFunction shortFunction); MutableStack collectWith(Function2 function, P parameter); MutableStack collectIf(Predicate predicate, Function function); MutableStack flatCollect(Function> function); MutableListMultimap groupBy(Function function); MutableListMultimap groupByEach(Function> function); MutableMap groupByUniqueKey(Function function); MutableStack> zip(Iterable that); MutableStack> zipWithIndex(); }