List - p package lab12; p public class List cfw_ final int...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
package lab12; p public class List { p final int MAX_SIZE = 100; private Object [] list; private int index; private int pos; p public List() { list = new Object[MAX_SIZE]; index = 0; pos = 0; } public List(int newSize) { list = new Object[newSize]; index = 0; pos = 0; } public int getLength() { return list.length; } public void insert(Object anObj) { int iteration = 0; list[index] = anObj; index++; System.out.println(iteration); } public void insert(Object anObj, int i) { list[i] = anObj; } public int getIndex() { return index; } public void delete(Object anObj) { int found = this.isThere(anObj); if(found > -1) { for(int i = found; i < index; i++) { list[i] = list[i+1]; } } index --;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
} public boolean isEmpty() { if(index == 0) return true; else return false; } public boolean isFull() { if(index == list.length) return true; else return false; } public void reset() { pos = 0; } public Object getNext() { if(pos == index-1) this.reset(); return list[pos]; } public void display() { for(int i= 0; i<index; i++)
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/10/2009 for the course CS 102 taught by Professor Kanipiakins during the Spring '09 term at University of Maryland Baltimore.

Page1 / 4

List - p package lab12; p public class List cfw_ final int...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online