WordList

WordList - /* CLASS WORDLIST C constructor sort method...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: /* CLASS WORDLIST C constructor sort method search method toString method t have WordList class fill the array WordList stores the data as an ArrayList so its the only class that knows the data is stored in an ArrayList */ * public class WordList extends Word{ p ArrayList<Word> list = new ArrayList<Word>(); //creates arraylist with initial value of 10 i public WordList(){ p }//constructor } /* public static void sortWords( String arr, int ct) { ArrayList <word> Stuff = new ArrayList<String>(); // Above lines show use of "Generics" - compare to // Templates in C++ BufferedReader Source = new BufferedReader( new FileReader("../request.txt")); System.out.println("---------- UnSorted"); while (Source.ready() ) { String Line = Source.readLine(); System.out.println(Line); Stuff.add(Line); } System.out.println("---------- Alphabetic Sort"); Collections.sort(Stuff); Iterator stepper = Stuff.iterator(); while (stepper.hasNext()) { String current = (String)stepper.next(); System.out.println(current); }...
View Full Document

This note was uploaded on 06/07/2010 for the course CS 201 taught by Professor Staff during the Spring '08 term at Iona.

Page1 / 3

WordList - /* CLASS WORDLIST C constructor sort method...

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

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