home *** CD-ROM | disk | FTP | other *** search
- package com.kav.util;
-
- import java.util.EmptyStackException;
-
- public class QuickStack extends List {
- public boolean empty() {
- return ((List)this).size() == 0;
- }
-
- public Object peek() throws EmptyStackException {
- if (this.empty()) {
- throw new EmptyStackException();
- } else {
- return super.get(((List)this).size() - 1);
- }
- }
-
- public Object pop() throws EmptyStackException {
- if (this.empty()) {
- throw new EmptyStackException();
- } else {
- return ((List)this).remove(((List)this).size() - 1);
- }
- }
-
- public void push(Object var1) {
- super.add(var1);
- }
-
- public int search(Object var1) {
- int var2 = ((List)this).indexOf(var1);
- return var2 >= 0 ? ((List)this).size() - 1 - var2 : var2;
- }
- }
-