Class IntArrayStack
- java.lang.Object
-
- org.eclipse.collections.impl.stack.primitive.AbstractIntStack
-
- org.eclipse.collections.impl.stack.mutable.primitive.IntArrayStack
-
- All Implemented Interfaces:
java.io.Externalizable,java.io.Serializable,IntIterable,OrderedIntIterable,PrimitiveIterable,IntStack,MutableIntStack
public class IntArrayStack extends AbstractIntStack implements MutableIntStack, java.io.Externalizable
IntArrayStack is similar toArrayStack, and is memory-optimized for int primitives. This file was automatically generated from template file primitiveArrayStack.stg.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private IntArrayListdelegateprivate static longserialVersionUID
-
Constructor Summary
Constructors Modifier Constructor Description IntArrayStack()privateIntArrayStack(int size)privateIntArrayStack(int... items)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MutableIntStackasSynchronized()MutableIntStackasUnmodifiable()voidclear()Clears the Stack<V> MutableStack<V>collect(IntToObjectFunction<? extends V> function)Returns a new collection with the results of applying the specified function on each element of the source collection.booleanequals(java.lang.Object otherStack)Follows the same general contract asStackIterable.equals(Object).protected IntArrayListgetDelegate()inthashCode()Follows the same general contract asStackIterable.hashCode().IntArrayStacknewEmpty()Creates a new empty IntArrayStack.static IntArrayStacknewStack(IntIterable items)static IntArrayStacknewStackFromTopToBottom(int... items)static IntArrayStacknewStackFromTopToBottom(IntIterable items)static IntArrayStacknewStackWith(int... items)intpop()Removes and returns the top element of the stack.IntListpop(int count)Removes and returns a IntList of the number of elements specified by the count, beginning with the top of the stack.voidpush(int item)Adds an item to the top of the stack.voidreadExternal(java.io.ObjectInput in)MutableIntStackreject(IntPredicate predicate)Returns a new IntIterable with all of the elements in the IntIterable that return false for the specified predicate.MutableIntStackselect(IntPredicate predicate)Returns a new IntIterable with all of the elements in the IntIterable that return true for the specified predicate.ImmutableIntStacktoImmutable()MutableIntListtoSortedList()MutableIntStacktoStack()Converts the collection to a IntStack.voidwriteExternal(java.io.ObjectOutput out)-
Methods inherited from class org.eclipse.collections.impl.stack.primitive.AbstractIntStack
allSatisfy, anySatisfy, appendString, appendString, appendString, asLazy, average, checkEmptyStack, checkPositiveValueForCount, checkSizeLessThanCount, chunk, contains, containsAll, containsAll, count, detectIfNone, each, forEachWithIndex, getFirst, indexOf, injectInto, injectIntoWithIndex, intIterator, makeString, makeString, makeString, max, maxIfEmpty, median, min, minIfEmpty, noneSatisfy, peek, peek, peekAt, rangeCheck, size, sum, toArray, toArray, toBag, toList, toSet, toSortedArray, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.collections.api.IntIterable
allSatisfy, anySatisfy, asLazy, average, averageIfEmpty, chunk, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, contains, containsAll, containsAll, containsAny, containsAny, containsNone, containsNone, count, detectIfNone, each, flatCollect, forEach, injectInto, injectIntoBoolean, injectIntoByte, injectIntoChar, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, injectIntoShort, intIterator, max, maxIfEmpty, median, medianIfEmpty, min, minIfEmpty, noneSatisfy, reduce, reduceIfEmpty, reject, select, sum, summaryStatistics, toArray, toArray, toBag, toList, toSet, toSortedArray, toSortedList, toSortedListBy, toSortedListBy
-
Methods inherited from interface org.eclipse.collections.api.stack.primitive.IntStack
peek, peek, peekAt
-
Methods inherited from interface org.eclipse.collections.api.stack.primitive.MutableIntStack
collectWithIndex, rejectWithIndex, selectWithIndex, tap
-
Methods inherited from interface org.eclipse.collections.api.ordered.primitive.OrderedIntIterable
collectWithIndex, forEachWithIndex, getFirst, indexOf, injectIntoWithIndex, rejectWithIndex, selectWithIndex
-
Methods inherited from interface org.eclipse.collections.api.PrimitiveIterable
appendString, appendString, appendString, isEmpty, makeString, makeString, makeString, notEmpty, size, toString
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
delegate
private transient IntArrayList delegate
-
-
Method Detail
-
newStackFromTopToBottom
public static IntArrayStack newStackFromTopToBottom(int... items)
-
newStackWith
public static IntArrayStack newStackWith(int... items)
-
newStack
public static IntArrayStack newStack(IntIterable items)
-
newStackFromTopToBottom
public static IntArrayStack newStackFromTopToBottom(IntIterable items)
-
getDelegate
protected IntArrayList getDelegate()
- Specified by:
getDelegatein classAbstractIntStack
-
push
public void push(int item)
Description copied from interface:MutableIntStackAdds an item to the top of the stack.- Specified by:
pushin interfaceMutableIntStack
-
pop
public int pop()
Description copied from interface:MutableIntStackRemoves and returns the top element of the stack.- Specified by:
popin interfaceMutableIntStack
-
pop
public IntList pop(int count)
Description copied from interface:MutableIntStackRemoves and returns a IntList of the number of elements specified by the count, beginning with the top of the stack.- Specified by:
popin interfaceMutableIntStack
-
select
public MutableIntStack select(IntPredicate predicate)
Description copied from interface:IntIterableReturns a new IntIterable with all of the elements in the IntIterable that return true for the specified predicate.- Specified by:
selectin interfaceIntIterable- Specified by:
selectin interfaceIntStack- Specified by:
selectin interfaceMutableIntStack- Specified by:
selectin interfaceOrderedIntIterable
-
reject
public MutableIntStack reject(IntPredicate predicate)
Description copied from interface:IntIterableReturns a new IntIterable with all of the elements in the IntIterable that return false for the specified predicate.- Specified by:
rejectin interfaceIntIterable- Specified by:
rejectin interfaceIntStack- Specified by:
rejectin interfaceMutableIntStack- Specified by:
rejectin interfaceOrderedIntIterable
-
collect
public <V> MutableStack<V> collect(IntToObjectFunction<? extends V> function)
Description copied from interface:IntIterableReturns a new collection with the results of applying the specified function on each element of the source collection. This method is also commonly called transform or map.- Specified by:
collectin interfaceIntIterable- Specified by:
collectin interfaceIntStack- Specified by:
collectin interfaceMutableIntStack- Specified by:
collectin interfaceOrderedIntIterable
-
clear
public void clear()
Description copied from interface:MutableIntStackClears the Stack- Specified by:
clearin interfaceMutableIntStack
-
toSortedList
public MutableIntList toSortedList()
- Specified by:
toSortedListin interfaceIntIterable
-
asUnmodifiable
public MutableIntStack asUnmodifiable()
- Specified by:
asUnmodifiablein interfaceMutableIntStack
-
asSynchronized
public MutableIntStack asSynchronized()
- Specified by:
asSynchronizedin interfaceMutableIntStack
-
toImmutable
public ImmutableIntStack toImmutable()
- Specified by:
toImmutablein interfaceIntStack
-
newEmpty
public IntArrayStack newEmpty()
Creates a new empty IntArrayStack.- Specified by:
newEmptyin interfaceMutableIntStack- Since:
- 9.2.
-
equals
public boolean equals(java.lang.Object otherStack)
Description copied from interface:IntStackFollows the same general contract asStackIterable.equals(Object).- Specified by:
equalsin interfaceIntStack- Overrides:
equalsin classAbstractIntStack
-
hashCode
public int hashCode()
Description copied from interface:IntStackFollows the same general contract asStackIterable.hashCode().- Specified by:
hashCodein interfaceIntStack- Overrides:
hashCodein classAbstractIntStack
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException- Specified by:
writeExternalin interfacejava.io.Externalizable- Throws:
java.io.IOException
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException- Specified by:
readExternalin interfacejava.io.Externalizable- Throws:
java.io.IOException
-
toStack
public MutableIntStack toStack()
Description copied from interface:OrderedIntIterableConverts the collection to a IntStack.- Specified by:
toStackin interfaceOrderedIntIterable
-
-