Bo coś takiego nie działa:
Scanner scanner = new Scanner("1 2 3 4");
List<Integer> numbers = new ArrayList<>();
while(numbers.add(scanner.nextInt())){}
nextInt rzuca wyjątkiem java.util.NoSuchElementException gdy skończą się inty.
A tak na marginesie to nie jest Ci potrzebna lista bo liczby możesz dodawać w locie i zapominać:
Scanner scanner = new Scanner(System.in);
int sum = 0;
while (scanner.hasNextInt()) {
sum += scanner.nextInt();
System.out.println(sum);
}