class Hylle implements GenHylle { private int storrelse; private T[] arr; Hylle(int storrelse) { this.storrelse = storrelse; this.arr = (T[])(new Object[storrelse]); } public int hentStorrelse() { return storrelse; } public void settInn(int plass, T ting) throws Exception { if (arr[plass] == null) arr[plass] = ting; else throw new Exception("Plass "+plass+" er ikke ledig."); } public boolean erLedig(int plass) throws Exception { return arr[plass] == null; } public T hent(int plass) { T ting = arr[plass]; arr[plass] = null; return ting; } }