public Object get(int index) { int i = 0; RoopsListNode curr = this.header; RoopsListNode prev = null; while (i < index) { prev = curr; curr = curr.next; i++; } return(curr.object_value); }
public boolean add(Object elem) { RoopsListNode new_node = new RoopsListNode(elem); if (len==0) { header = new_node; } else { RoopsListNode curr = this.header; while (curr.next!=null) { curr = curr.next; } curr.next = new_node; } len++; return true; }
public int indexOf(Object elem) { RoopsListNode curr = this.header; int index = 0; while (curr != null) { if (curr.object_value == elem) { return(index); } curr = curr.next; index++; } return(-1); }
public boolean add(Object elem) { RoopsListNode new_node = new RoopsListNode(elem); if (len == 0) { header = new_node; } else { RoopsListNode curr = this.header; while (curr.next != null) { curr = curr.next; } curr.next = new_node; } len++; return(true); }
public boolean remove(int index) { if (index == 0) { header = header.next; } else { int i = 0; RoopsListNode prev = null; RoopsListNode curr = this.header; while (i < index) { prev = curr; curr = curr.next; i++; } prev.next = curr.next; } len--; return(true); }
public boolean remove(int index) { if (index==0) { header = header.next; } else { int i=0; RoopsListNode prev = null; RoopsListNode curr = this.header; while (i<index) { prev = curr; curr = curr.next; i++; } prev.next = curr.next; } len--; return true; }
public void clear() { header = null; len = 0; }
public void clear() { header = null; len = 0; }
public RoopsListNode(Object new_object_value) { this.object_value = new_object_value; this.next = null; }
public RoopsListNode(Object new_object_value) { this.object_value = new_object_value; this.next = null; }