Dropping fibonacci numbers

Report a typo

Here is a snippet of code with the dropWhile method.

List<Integer> fibonacci = List.of(0, 1, 1, 2, 3, 5, 8, 13);

List<Integer> result = fibonacci.stream()
        .dropWhile(n -> n > 5)
        .collect(Collectors.toList());

Enter all the elements which are contained in the result list. Separate the elements with a single space like in the following example:

1 2 3 5

You may be a little surprised at the answer. If you cannot solve the problem manually, just start this code and then try to understand it.

Enter a short text
___

Create a free account to access the full topic