package esimene; public class Pinu { @SuppressWarnings("unchecked") T[] sisu=(T[])new Object[100]; private int kogus=0; public int size(){return kogus;} public void push(T uus){ sisu[kogus++]=uus; } public T peek(){ if(kogus<=0){throw new IllegalStateException();} return sisu[kogus-1]; } public T pop(){ if(kogus<=0){throw new IllegalStateException();} return sisu[--kogus]; } }