Back to project page androidcodes.
The source code is released under:
GNU General Public License
If you think the Android project androidcodes listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.stacks; //from w w w . j a v a2 s.co m public class StackImpl<E> { protected E[] stacklist; private int position; public StackImpl() { stacklist = (E[])new Object[20]; } public void push(E e) { stacklist[++position] = e; System.out.println("pos, push" + position); } public E pop() { System.out.println("pos, pop" + position); return stacklist[position--]; } public E peek() { return stacklist[position]; } public boolean isEmpty() { System.out.println("position is " + position); return position == 0; } }