import java.util.NoSuchElementException;
import java.util.Stack;
public  class StackList<T> implements SomeList<E>{
    /* Comments
     * only use offer(), poll()/remove, isEmpty(), and size() methods*/

    private Stack<T> stack=new Stack<T>();
    public StackList(){
        Stack<T> stack=new Stack<T>();
        stack=stack1;
    }

    public void push(T thing){
        stack1.push(thing);
    }
    @Override
    public T pop(){
        if(this.isEmpty()){throw new StackOverflowError();}
        return stack1.pop();
    }
    @Override
    public void add(T thing) {
        stack1.push(thing);
    }
    public void addFront(T thing) {
        int size=this.size();
        T[] arr=(T[]) new Object[size];
        int i=0;
        while(!this.isEmpty()){arr[i]=this.pop();i++;}
    }
    public T remove(int index) {
        if(index>this.size()){throw new IndexOutOfBoundsException();}
        else{int sze=this.size();
            T[] arr1=(T[])new Object[this.size()];
            int i=0;
            while(!this.isEmpty()){arr1[i]=this.pop();i++;}
            T vre = arr1[index];
            for(int j=0;j<size;j++){this.push(arr1[i]);}
            return vre;
        } 
    }
    public E removeEnd() {
        if(this.isEmpty()){return null;}
        return this.pop();
    }
    public E get(int index) {int sze=this.size();
        if(index>sze){throw new NoSuchElementException();}
        else{
            T[] arr2=(T[]) new Object[sze];
            int i=0;
            while(!this.isEmpty()){arr2[i]=this.pop();i++;}
            for(int j=0;j<sze;j++){this.push(arr2[j]);}
            return arr2[index];
        }
    }
    public int size() {
        return this.size();
    }
    public boolean isEmpty() {
        return this.isEmpty();
    }
}

Normally I would say " go ahead and test it, you'll soons ee if it's ok". But in this case you have a couple of catastrphic mistakes that will prevent any useful testing. You have 2 methods that look something like

int doIt() {
   return doIt();
}

These will call themselves recursively until you get a stack overflow.

Normally methods like that simply return a (private) local variable, or some result derived from local variables.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.