Package components.stack
Interface Stack<T>
- Type Parameters:
T- type ofStackentries
- All Superinterfaces:
Iterable<T>,StackKernel<T>,Standard<Stack<T>>
- All Known Implementing Classes:
Stack1L,Stack2,Stack3,StackSecondary
StackKernel enhanced with secondary methods.-
Method Summary
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliteratorMethods inherited from interface components.stack.StackKernel
length, pop, pushMethods inherited from interface components.standard.Standard
clear, newInstance, transferFrom
-
Method Details
-
top
Reports the top ofthis.- Returns:
- the top entry of
this - Aliases:
- reference returned by
top - Requires:
this /= <>- Ensures:
<top> is prefix of this
-
replaceTop
Replaces the top ofthiswithx, and returns the old top.- Parameters:
x- the new top entry- Returns:
- the old top entry
- Aliases:
- reference
x - Updates:
this- Requires:
this /= <>- Ensures:
<replaceTop> is prefix of #this and this = <x> * #this[1, |#this|)
-
flip
void flip()Reverses ("flips")this.- Updates:
this- Ensures:
this = rev(#this)
-