How do I remove a word that contains a dash from a text?

so I want to remove a word that contains a dash between them like off-campus alongside other things that I want to remove. here is my code so far. Scanner read = new Scanner(System.in); String text; /…

Difference between Arraylist.forEach() and Arraylist.replaceAll()

I have a question about the difference between Arraylist.forEach() and Arraylist.replaceAll(). I know that Arraylist.forEach() is used to perform an action for each element in the list, but it seems …