Question: Java programming 1)Read all words from a file and add them to a map whose keys are the first letters of the words and whose
Java programming
1)Read all words from a file and add them to a map whose keys are the first letters of the words and whose values are sets of words that start with that same letter. Then print out the word sets in alphabetical order.
Sample input file: She took down a jar from one of the shelves as she passed; it was labelled 'ORANGE MARMALADE', but to her great disappointment it was empty.
Output:
a: [a, as]
b: [but]
d: [disappointment, down]
e: [empty]
f: [from]
g: [great]
h: [her]
i: [it]
j: [jar]
l: [labelled]
m: [marmalade]
o: [of, one, orange]
p: [passed]
s: [she, shelves]
t: [the, to, took]
w: [was]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
