List.of()
`List.of()` is a method in Java that creates an immutable list, meaning the list cannot be modified after it is created. This method is part of the `java.util` package and was introduced in Java 9. It allows developers to easily create a list with a fixed set of elements without needing to use a constructor or additional methods.
Using `List.of()`, you can quickly create a list by passing the desired elements as arguments. For example, `List.of("apple", "banana", "cherry")` creates a list containing these three fruits. This feature simplifies code and enhances readability by reducing boilerplate code associated with list creation.