Create a Java program that groups a list of words that are anagrams of each other.
Example:
Input → ["eat", "tea", "tan", "ate", "nat", "bat"]
Output → [["eat", "tea", "ate"], ["tan", "nat"], ["bat"]]
Task:
- Implement the solution in Java (algorithms/AnagramGrouping.java).
- Use a HashMap where the key is the sorted version of each word, and the value is a list of all words matching that key.
- Return the grouped anagrams as a list of lists.
- Add clear comments explaining each step.
- Include one sample test case in the main() function for demonstration.
Hey @SilvaneUX
Can you please assign this issue under Hacktoberfest 2025? 🚀
Create a Java program that groups a list of words that are anagrams of each other.
Example:
Input → ["eat", "tea", "tan", "ate", "nat", "bat"]
Output → [["eat", "tea", "ate"], ["tan", "nat"], ["bat"]]
Task:
Hey @SilvaneUX
Can you please assign this issue under Hacktoberfest 2025? 🚀