Question
Use Comparable interface and the compareTo function,(do not use Map or tree) just simple array list sort to Write a JAVA program called Count that
Use Comparable interface and the compareTo function,(do not use Map or tree) just simple array list sort to Write a JAVA program called Count that takes an ArrayList of strings and lists the number of occurrences of unique strings as an arrayList in ascending order. You can asume the list of strings is in alphabetical order. Examples: [be, be, is, not, or, the, to, to] becomes [1,1,1,1,2,2] because is, not, or and the each occur once while be and to occur twice [a, a, a, a, a] becomes [5]. Make your comparisons case insensitive, i.e. [a, a, A, a, a] also becomes [5]. Have the user input strings from the console to populate your ArrayList. Assume that the user enters only String values in alphabetical order. Use the sentinal "lSTOP" to signify the end of user inpu
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started