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 IntArrayList
delegate
private static long
serialVersionUID
-
Constructor Summary
Constructors Modifier Constructor Description IntArrayStack()
private
IntArrayStack(int size)
private
IntArrayStack(int... items)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MutableIntStack
asSynchronized()
MutableIntStack
asUnmodifiable()
void
clear()
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.boolean
equals(java.lang.Object otherStack)
Follows the same general contract asStackIterable.equals(Object)
.protected IntArrayList
getDelegate()
int
hashCode()
Follows the same general contract asStackIterable.hashCode()
.IntArrayStack
newEmpty()
Creates a new empty IntArrayStack.static IntArrayStack
newStack(IntIterable items)
static IntArrayStack
newStackFromTopToBottom(int... items)
static IntArrayStack
newStackFromTopToBottom(IntIterable items)
static IntArrayStack
newStackWith(int... items)
int
pop()
Removes and returns the top element of the stack.IntList
pop(int count)
Removes and returns a IntList of the number of elements specified by the count, beginning with the top of the stack.void
push(int item)
Adds an item to the top of the stack.void
readExternal(java.io.ObjectInput in)
MutableIntStack
reject(IntPredicate predicate)
Returns a new IntIterable with all of the elements in the IntIterable that return false for the specified predicate.MutableIntStack
select(IntPredicate predicate)
Returns a new IntIterable with all of the elements in the IntIterable that return true for the specified predicate.ImmutableIntStack
toImmutable()
MutableIntList
toSortedList()
void
writeExternal(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:
getDelegate
in classAbstractIntStack
-
push
public void push(int item)
Description copied from interface:MutableIntStack
Adds an item to the top of the stack.- Specified by:
push
in interfaceMutableIntStack
-
pop
public int pop()
Description copied from interface:MutableIntStack
Removes and returns the top element of the stack.- Specified by:
pop
in interfaceMutableIntStack
-
pop
public IntList pop(int count)
Description copied from interface:MutableIntStack
Removes and returns a IntList of the number of elements specified by the count, beginning with the top of the stack.- Specified by:
pop
in interfaceMutableIntStack
-
select
public MutableIntStack select(IntPredicate predicate)
Description copied from interface:IntIterable
Returns a new IntIterable with all of the elements in the IntIterable that return true for the specified predicate.- Specified by:
select
in interfaceIntIterable
- Specified by:
select
in interfaceIntStack
- Specified by:
select
in interfaceMutableIntStack
- Specified by:
select
in interfaceOrderedIntIterable
-
reject
public MutableIntStack reject(IntPredicate predicate)
Description copied from interface:IntIterable
Returns a new IntIterable with all of the elements in the IntIterable that return false for the specified predicate.- Specified by:
reject
in interfaceIntIterable
- Specified by:
reject
in interfaceIntStack
- Specified by:
reject
in interfaceMutableIntStack
- Specified by:
reject
in interfaceOrderedIntIterable
-
collect
public <V> MutableStack<V> collect(IntToObjectFunction<? extends V> function)
Description copied from interface:IntIterable
Returns 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:
collect
in interfaceIntIterable
- Specified by:
collect
in interfaceIntStack
- Specified by:
collect
in interfaceMutableIntStack
- Specified by:
collect
in interfaceOrderedIntIterable
-
clear
public void clear()
Description copied from interface:MutableIntStack
Clears the Stack- Specified by:
clear
in interfaceMutableIntStack
-
toSortedList
public MutableIntList toSortedList()
- Specified by:
toSortedList
in interfaceIntIterable
-
asUnmodifiable
public MutableIntStack asUnmodifiable()
- Specified by:
asUnmodifiable
in interfaceMutableIntStack
-
asSynchronized
public MutableIntStack asSynchronized()
- Specified by:
asSynchronized
in interfaceMutableIntStack
-
toImmutable
public ImmutableIntStack toImmutable()
- Specified by:
toImmutable
in interfaceIntStack
-
newEmpty
public IntArrayStack newEmpty()
Creates a new empty IntArrayStack.- Specified by:
newEmpty
in interfaceMutableIntStack
- Since:
- 9.2.
-
equals
public boolean equals(java.lang.Object otherStack)
Description copied from interface:IntStack
Follows the same general contract asStackIterable.equals(Object)
.- Specified by:
equals
in interfaceIntStack
- Overrides:
equals
in classAbstractIntStack
-
hashCode
public int hashCode()
Description copied from interface:IntStack
Follows the same general contract asStackIterable.hashCode()
.- Specified by:
hashCode
in interfaceIntStack
- Overrides:
hashCode
in classAbstractIntStack
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
- Specified by:
writeExternal
in interfacejava.io.Externalizable
- Throws:
java.io.IOException
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException
- Specified by:
readExternal
in interfacejava.io.Externalizable
- Throws:
java.io.IOException
-
-