Class CharArrayStack
- java.lang.Object
-
- org.eclipse.collections.impl.stack.primitive.AbstractCharStack
-
- org.eclipse.collections.impl.stack.mutable.primitive.CharArrayStack
-
- All Implemented Interfaces:
java.io.Externalizable
,java.io.Serializable
,CharIterable
,OrderedCharIterable
,PrimitiveIterable
,CharStack
,MutableCharStack
public class CharArrayStack extends AbstractCharStack implements MutableCharStack, java.io.Externalizable
CharArrayStack is similar toArrayStack
, and is memory-optimized for char primitives. This file was automatically generated from template file primitiveArrayStack.stg.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private CharArrayList
delegate
private static long
serialVersionUID
-
Constructor Summary
Constructors Modifier Constructor Description CharArrayStack()
private
CharArrayStack(char... items)
private
CharArrayStack(int size)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MutableCharStack
asSynchronized()
MutableCharStack
asUnmodifiable()
void
clear()
Clears the Stack<V> MutableStack<V>
collect(CharToObjectFunction<? 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 CharArrayList
getDelegate()
int
hashCode()
Follows the same general contract asStackIterable.hashCode()
.CharArrayStack
newEmpty()
Creates a new empty CharArrayStack.static CharArrayStack
newStack(CharIterable items)
static CharArrayStack
newStackFromTopToBottom(char... items)
static CharArrayStack
newStackFromTopToBottom(CharIterable items)
static CharArrayStack
newStackWith(char... items)
char
pop()
Removes and returns the top element of the stack.CharList
pop(int count)
Removes and returns a CharList of the number of elements specified by the count, beginning with the top of the stack.void
push(char item)
Adds an item to the top of the stack.void
readExternal(java.io.ObjectInput in)
MutableCharStack
reject(CharPredicate predicate)
Returns a new CharIterable with all of the elements in the CharIterable that return false for the specified predicate.MutableCharStack
select(CharPredicate predicate)
Returns a new CharIterable with all of the elements in the CharIterable that return true for the specified predicate.ImmutableCharStack
toImmutable()
MutableCharList
toSortedList()
void
writeExternal(java.io.ObjectOutput out)
-
Methods inherited from class org.eclipse.collections.impl.stack.primitive.AbstractCharStack
allSatisfy, anySatisfy, appendString, appendString, appendString, asLazy, average, charIterator, checkEmptyStack, checkPositiveValueForCount, checkSizeLessThanCount, chunk, contains, containsAll, containsAll, count, detectIfNone, each, forEachWithIndex, getFirst, indexOf, injectInto, injectIntoWithIndex, 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.CharIterable
allSatisfy, anySatisfy, asLazy, average, averageIfEmpty, charIterator, 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, 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.CharStack
peek, peek, peekAt
-
Methods inherited from interface org.eclipse.collections.api.stack.primitive.MutableCharStack
collectWithIndex, rejectWithIndex, selectWithIndex, tap
-
Methods inherited from interface org.eclipse.collections.api.ordered.primitive.OrderedCharIterable
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 CharArrayList delegate
-
-
Method Detail
-
newStackFromTopToBottom
public static CharArrayStack newStackFromTopToBottom(char... items)
-
newStackWith
public static CharArrayStack newStackWith(char... items)
-
newStack
public static CharArrayStack newStack(CharIterable items)
-
newStackFromTopToBottom
public static CharArrayStack newStackFromTopToBottom(CharIterable items)
-
getDelegate
protected CharArrayList getDelegate()
- Specified by:
getDelegate
in classAbstractCharStack
-
push
public void push(char item)
Description copied from interface:MutableCharStack
Adds an item to the top of the stack.- Specified by:
push
in interfaceMutableCharStack
-
pop
public char pop()
Description copied from interface:MutableCharStack
Removes and returns the top element of the stack.- Specified by:
pop
in interfaceMutableCharStack
-
pop
public CharList pop(int count)
Description copied from interface:MutableCharStack
Removes and returns a CharList of the number of elements specified by the count, beginning with the top of the stack.- Specified by:
pop
in interfaceMutableCharStack
-
select
public MutableCharStack select(CharPredicate predicate)
Description copied from interface:CharIterable
Returns a new CharIterable with all of the elements in the CharIterable that return true for the specified predicate.- Specified by:
select
in interfaceCharIterable
- Specified by:
select
in interfaceCharStack
- Specified by:
select
in interfaceMutableCharStack
- Specified by:
select
in interfaceOrderedCharIterable
-
reject
public MutableCharStack reject(CharPredicate predicate)
Description copied from interface:CharIterable
Returns a new CharIterable with all of the elements in the CharIterable that return false for the specified predicate.- Specified by:
reject
in interfaceCharIterable
- Specified by:
reject
in interfaceCharStack
- Specified by:
reject
in interfaceMutableCharStack
- Specified by:
reject
in interfaceOrderedCharIterable
-
collect
public <V> MutableStack<V> collect(CharToObjectFunction<? extends V> function)
Description copied from interface:CharIterable
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 interfaceCharIterable
- Specified by:
collect
in interfaceCharStack
- Specified by:
collect
in interfaceMutableCharStack
- Specified by:
collect
in interfaceOrderedCharIterable
-
clear
public void clear()
Description copied from interface:MutableCharStack
Clears the Stack- Specified by:
clear
in interfaceMutableCharStack
-
toSortedList
public MutableCharList toSortedList()
- Specified by:
toSortedList
in interfaceCharIterable
-
asUnmodifiable
public MutableCharStack asUnmodifiable()
- Specified by:
asUnmodifiable
in interfaceMutableCharStack
-
asSynchronized
public MutableCharStack asSynchronized()
- Specified by:
asSynchronized
in interfaceMutableCharStack
-
toImmutable
public ImmutableCharStack toImmutable()
- Specified by:
toImmutable
in interfaceCharStack
-
newEmpty
public CharArrayStack newEmpty()
Creates a new empty CharArrayStack.- Specified by:
newEmpty
in interfaceMutableCharStack
- Since:
- 9.2.
-
equals
public boolean equals(java.lang.Object otherStack)
Description copied from interface:CharStack
Follows the same general contract asStackIterable.equals(Object)
.- Specified by:
equals
in interfaceCharStack
- Overrides:
equals
in classAbstractCharStack
-
hashCode
public int hashCode()
Description copied from interface:CharStack
Follows the same general contract asStackIterable.hashCode()
.- Specified by:
hashCode
in interfaceCharStack
- Overrides:
hashCode
in classAbstractCharStack
-
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
-
-