Channel: Java
Category: Science & Technology
Tags: jdkjvmcloudjavaoraclejava programming languagedeveloperjava virtual machineprogramming
Description: This #JEPCafe discusses 'Convenience Factory Methods for Collections' (JEP 269), released with JDK 9. Factory methods allow to create pre-filled collections and maps, that are immutable, that do not accept null values or keys, and that are Serializable. Let us quickly visit them, along with `Arrays.asList()`, `List.copyOf()` and the new `Stream.toList()` methods. ⎯⎯⎯⎯⎯⎯ Chapters ⎯⎯⎯⎯⎯⎯ 0:00 Intro 1:04 Creating pre-filled collections 2:00 Introducing `List.of()` 3:27 Creating immutable sets with `Set.of()` 4:15 Using `Map.of()` and `Map.ofEntries()` 6:20 Using `Arrays.asList()` to wrap arrays 7:40 Copying a list with `List.copyOf()` 8:58 Using `Stream.toList()` 11:09 Wrapping up the patterns 12:17 Outro ⎯⎯⎯⎯⎯⎯ Resources ⎯⎯⎯⎯⎯⎯ ◦ Dev.java ➱ dev.java ◦ How to use Preview Features ➱ dev.java/learn/using-the-preview-features-available-in-the-jdk ◦ JEP 269: Convenience Factory Methods for Collections ➱ openjdk.java.net/jeps/269 ◦ JDK 17 ➱ jdk.java.net/17 ◦ OpenJDK ➱ openjdk.java.net ◦ Oracle Java ➱ oracle.com/java Categories: #Java #OpenJDK #JDK