Question: // import java.io.*; import java.util.*; public class QuizSet { // Add reportSet here // DO NOT MODIFY the code below //////////////////////////// public static void main
// import java.io.*; import java.util.*; public class QuizSet { // Add reportSet here // DO NOT MODIFY the code below //////////////////////////// public static void main (String [] args) { try{ //ArrayList ArrayList words = new ArrayList(); Scanner input = new Scanner (new File ("mobydick.txt")); while (input.hasNext()) { words.add(input.next()); } System.out.println (reportSet(words).size()); } catch (FileNotFoundException e) { System.out.println (e); } } } //
//
Add a method called reportSet that accepts a list of Strings as its parameter and returns a new set containing only the unique words from the list.
There are 32553 Unique words in the Mobydick file.
mobydick.txt
Can you please help me with this programming?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
