Last active
November 3, 2021 13:25
-
-
Save EduardoSaverin/46754fa077cd9e4d8159452a105c68ef to your computer and use it in GitHub Desktop.
java9list
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
List<String> list=List.of("apple","bat"); | |
List<String> list=List.of("apple",null); // It doesn't allow null values - NullPointerException will be thrown if added. | |
Set<String> set1= Set.of("apple","bat"); | |
Set<String> set2= Set.of(); | |
Map<Integer,String> emptyMap = Map.of(); | |
Map<Integer,String> map = Map.of(1, "Apple", 2, "Bat", 3, "Cat"); | |
Map<Integer,String> mapEntry = Map.ofEntries( | |
Map.entry(1,"Apple"), | |
Map.entry(2,"Bat"), | |
Map.entry(3,"Cat")); |
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
List<String> list=List.of("apple","bat"); | |
List<String> list=List.of("apple",null); // It doesn't allow null values - NullPointerException will be thrown if added. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment