Is `.toList()` a standard Java method? When was it introduced?

Question

Grade: Education Subject: Support
Is `.toList()` a standard Java method? When was it introduced?
Asked by:
62 Viewed 62 Answers

Answer (62)

Best Answer
(272)
`.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.