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
| jshell> IntStream.range(0,10).takeWhile(x -> x < 5).forEach(System.out::println) | |
| 0 | |
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| jshell> IntStream.range(0,10).dropWhile(x -> x < 5).forEach(System.out::println) | |
| 5 | |
| 6 |
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
| jshell> IntStream.range(0,10).limit(5).forEach(System.out::println) | |
| 0 | |
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| jshell> IntStream.range(0,10).skip(5).forEach(System.out::println) | |
| 5 | |
| 6 |
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
| jshell> IntStream.range(0,10).forEach(System.out::println) | |
| 0 | |
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 |
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
| jshell> Map.ofEntries( | |
| Signatures: | |
| Map<K,V> Map<K, V>.<K, V>ofEntries(Map.Entry<? extends K,? extends V>... entries) | |
| <press tab again to see documentation> | |
| jshell> Map.ofEntries(Map.entry(1, "hello readers of the blog")) | |
| $15 ==> {1=hello readers of the blog} |
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
| jshell> Map.of( | |
| Signatures: | |
| Map<K,V> Map<K, V>.<K, V>of() | |
| Map<K,V> Map<K, V>.<K, V>of(K k1, V v1) | |
| Map<K,V> Map<K, V>.<K, V>of(K k1, V v1, K k2, V v2) | |
| Map<K,V> Map<K, V>.<K, V>of(K k1, V v1, K k2, V v2, K k3, V v3) | |
| Map<K,V> Map<K, V>.<K, V>of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) | |
| Map<K,V> Map<K, V>.<K, V>of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) | |
| Map<K,V> Map<K, V>.<K, V>of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) | |
| Map<K,V> Map<K, V>.<K, V>of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) |
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
| jshell> Set<String> set = Set.of("a", "b", "c") | |
| set ==> [c, b, a] |
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
| jshell> Set.of( | |
| Signatures: | |
| Set<E> Set<E>.<E>of() | |
| Set<E> Set<E>.<E>of(E e1) | |
| Set<E> Set<E>.<E>of(E e1, E e2) | |
| Set<E> Set<E>.<E>of(E e1, E e2, E e3) | |
| Set<E> Set<E>.<E>of(E e1, E e2, E e3, E e4) | |
| Set<E> Set<E>.<E>of(E e1, E e2, E e3, E e4, E e5) | |
| Set<E> Set<E>.<E>of(E e1, E e2, E e3, E e4, E e5, E e6) | |
| Set<E> Set<E>.<E>of(E e1, E e2, E e3, E e4, E e5, E e6, E e7) |
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
| jshell> list.add("d") | |
| | java.lang.UnsupportedOperationException thrown: | |
| | at ImmutableCollections.uoe (ImmutableCollections.java:70) | |
| | at ImmutableCollections$AbstractImmutableList.add (ImmutableCollections.java:76) | |
| | at (#13:1) | |
| jshell> list.getClass() | |
| $14 ==> class java.util.ImmutableCollections$ListN |
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
| jshell> List<String> list = List.of("a", "b", "c") | |
| list ==> [a, b, c] |
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
| jshell> List.of( | |
| Signatures: | |
| List<E> List<E>.<E>of() | |
| List<E> List<E>.<E>of(E e1) | |
| List<E> List<E>.<E>of(E e1, E e2) | |
| List<E> List<E>.<E>of(E e1, E e2, E e3) | |
| List<E> List<E>.<E>of(E e1, E e2, E e3, E e4) | |
| List<E> List<E>.<E>of(E e1, E e2, E e3, E e4, E e5) | |
| List<E> List<E>.<E>of(E e1, E e2, E e3, E e4, E e5, E e6) | |
| List<E> List<E>.<E>of(E e1, E e2, E e3, E e4, E e5, E e6, E e7) |