I have been working on a Scrabble assignment. I need to read words from a list, then read each char and assign a value, eventually assigning a total score to each word. That has been done! Phew. Now I need to use the Comparator to sort the words from greatest score to least. I have done a lot of reading and I'm still confused. I know that I could use the interface, but there's also using Comparator with a lambda expression, which is the direction that I think I want to go. I'm just not sure how. I need to compare the sumValue I have for each word, then print the words in decreasing order.
I created 2 loops to read the word (i), then the chars (j). I have printed to the screen the score of each word (sumValue) and its location (i) in my ArrayList. Now I need to use Comparator to compare the scores, and then reorder the location. I think my problem is that I feel like I'm not sorting the Arraylist. I'm sorting the scores, which are not in an ArrayList. Do I need to create a new ArrayList with scores attached to each word and sort that?