Package components.stack
Class StackSecondary<T>
java.lang.Object
components.stack.StackSecondary<T>
- Type Parameters:
T
- type ofStack
entries
- All Implemented Interfaces:
Stack<T>
,StackKernel<T>
,Standard<Stack<T>>
,Iterable<T>
Layered implementations of secondary methods for
Stack
.
Execution-time performance of flip
implemented in this class is O(|
this
|).
-
Constructor Summary
-
Method Summary
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
Methods inherited from interface components.stack.StackKernel
length, pop, push
Methods inherited from interface components.standard.Standard
clear, newInstance, transferFrom
-
Constructor Details
-
StackSecondary
public StackSecondary()
-
-
Method Details
-
equals
-
hashCode
-
toString
-
top
Description copied from interface:Stack
Reports the top ofthis
. -
replaceTop
Description copied from interface:Stack
Replaces the top ofthis
withx
, and returns the old top.- Specified by:
replaceTop
in interfaceStack<T>
- Parameters:
x
- the new top entry- Returns:
- the old top entry
-
flip
Description copied from interface:Stack
Reverses ("flips")this
.
-