public static void main(String[] args) {
System.out.println(“Pride and Prejudice”);
ArrayList words1 = new ArrayList<>();
FileOperation.readFile(“pride-and-prejudice.txt”, words1);
System.out.println(“Total words:” + words1.size());
BSTSet<String> set1 = new BSTSet<>();
for(String word:words1){
set1.add(word);
}
System.out.println("Total different words:" + set1.getSize());
}
结果:
Pride and Prejudice
Total words:125901
Total different words:125901