Created
August 31, 2017 20:02
-
-
Save marchev/14d02ec5f5b9b810737c1bc12e096f05 to your computer and use it in GitHub Desktop.
Iterators and shit
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jshell> listOfFoos.stream().forEach(foo -> foo.setFoo(stringValues.iterator().next())); | |
jshell> listOfFoos.stream().forEach(x -> System.out.println(x.getFoo())); | |
one | |
one | |
one | |
----------------------------------------------------------------------------------------- | |
jshell> Iterator<String> strValsIterator = stringValues.iterator(); | |
strValsIterator ==> java.util.Arrays$ArrayItr@6c3708b3 | |
jshell> listOfFoos.stream().forEach(foo -> foo.setFoo(strValsIterator.next())); | |
jshell> listOfFoos.stream().forEach(x -> System.out.println(x.getFoo())); | |
one | |
two | |
three |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment