Bon en fait j'ai vu sur le net qu'on peut contourner ça en imposant la condition while(true)... fallait le savoir.
package test;
import java.util.*;
public class Words {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
ArrayList<String> words = new ArrayList<String>();
while(true) {
System.out.println("Type a word : ");
String word = sc.nextLine();
words.add(word);
if(word.isEmpty()) {
System.out.println("You typed the following words : ");
for (int i = 0; i < words.size(); i++)
System.out.println(words.get(i));
break;
}
}
}
}
Mais du coup c'est beaucoup plus condensé.