Lecture3

Lecture3 - Node _next, _prev; Object _data; } // iterable?...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// public Object get (int index){ // need to check IndexOutOfBounds if( index < 0 || index >= _numElements) throw IndexOutofBoundsExpection(); return _underlyingStorage[index]; }//end of get public void remove(int index){ // Check valid index ... for(int i = index + 1; i <_numElements; i++){ _underlyingStorage[i-1] = _underlyingStorage[i]; } _numElements--; }//end of remove // hints class DoublyLL12 implements List12{ // inner class class Node{
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Node _next, _prev; Object _data; } // iterable? } //must instantiate object that iterates the iterator interface interface Iterable{ Iterator iterator(); } //implemnts? interface List12 extends Iterable{ } interface Iterator (){ boolean hasNext() remove Next() } class DLL12Iterator iimplents Iterator{ } ////// Final, nice queue for reader to knkow whats final final String s = System.in.readLine();...
View Full Document

This note was uploaded on 11/02/2011 for the course CSE 12 taught by Professor Gary during the Summer '08 term at UCSD.

Ask a homework question - tutors are online