Programming and Problem Solving with Java

(やまだぃちぅ) #1

(^530) | Array-Based Lists
List list2 = new List(20);
String line; // Used for reading input
// Read values and insert into lists
line = inFile.readLine();
while(line != null)
{
list1.insert(line);
line = inFile.readLine();
}
line = inFile2.readLine();
while(line != null)
{
list2.insert(line);
line = inFile2.readLine();
}
if (isDuplicate(list1, list2))
System.out.println("Lists are the same.");
else
System.out.println("Lists are not the same.");
inFile.close();
inFile2.close();
}
public booleanisDuplicate(List list1, List list2)
// Returns true if the lists are identical
{ ... }
}
T
E
A
M
F
L
Y
Team-Fly®

Free download pdf