You're welcome
Try the versions of the code with the Streams.
In the constructor you have a
String[] which you turn into a
Stream<String> with the method of the Arrays class.
Then you use the map method to create a different kind of Stream; the bit with :: in the middle means call the
valueOf(String) method of the Integer class. The compiler will presume you want to pass a String to that method because you are inside a Stream of Strings. Now you have a Stream<Integer>.
Then you use the collect method which uses a
Collector object to create a List. The actual Collector object is that whose reference is returned from
the toList method.
Instead of using the Iterator, the second line uses the
stream method, actually in the Collection interface, to create a Stream; since the List is a List<Integer> the Stream will be a Stream<Integer>. The
filter() method can
test whether the value is 3 or not. You want to keep everything which is not equal to 3. The compiler “knows” that it is possible to use the
intValue method or unboxing, so you can use != 3. Then you turn it back to a List with exactly the same technique with toList.