All pastes #493335 Raw Edit

Anonymous

public java v1 · immutable
·published 2007-05-17 18:28 UTC
rendered paste body
import java.io.*;public class BirdProgram {	public static void main(String[] args) throws IOException {		try {			BufferedReader br = new BufferedReader(new FileReader("birds.txt"));			String input;			BirdLinkedList list = new BirdLinkedList(null);			while ((input = br.readLine()) != null) {				BirdNode newNode = new BirdNode(input);				Boolean find = list.find(newNode);				if (find == false) {					list.insertEnd(newNode);				}				input = br.readLine();			}			br.close();			System.out.println("This is the original list: ");			System.out.println();			list.print();			BirdLinkedList sort = new BirdLinkedList(null);			while (list.head != null) {				BirdNode n = list.head;				BirdNode highest = n;				while (n != null) {					if (n.count > highest.count) highest = n;					n = n.next;				}				sort.insertEnd(highest);				list.remove(highest);			}			System.out.println();			System.out.println("Sorted List: ");			System.out.println();			sort.print();			BufferedReader br2 = new BufferedReader(new FileReader("birds2.txt"));			while ((input = br2.readLine()) != null) {				sort.remove(new BirdNode(input));			}			br2.close();						System.out.println();			System.out.println("Sorted list without rejected birds: ");			System.out.println();			sort.print();		} catch (IOException e) {			System.out.println(e.getMessage());		}	}}