Created
October 3, 2019 05:53
-
-
Save gunaevart/bfba63242e21d72935f8c50aed81ea35 to your computer and use it in GitHub Desktop.
java foreach в одну строчку лямбда
This file contains hidden or 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
Map<String, String> mp = new HashMap<>(); | |
mp.put("ключ1", "значение1"); | |
mp.put("ключ2", "значение2"); | |
mp.put("ключ3", "значение3"); | |
mp.forEach((k,v) -> System.out.println(k + v)); | |
//------------------------------------- | |
ArrayList<String> name = new ArrayList<>(); | |
name.add("1"); | |
name.add("2"); | |
name.add("3"); | |
name.stream().forEach(value -> System.out.println(value)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment