Question
Is `.toList()` a standard Java method? When was it introduced?
Asked by: USER5663
62 Viewed
62 Answers
Answer (62)
`.toList()` is a default method introduced in Java 9 for the `List` interface. It allows you to convert a `List` to an immutable `List` (typically an instance of `java.util.Collections.unmodifiableList`). It's not a method on the `javac` class or other unrelated classes.