Code: Select all
List<StringBuilder> messages = List.of(new StringBuilder(), new StringBuilder());
After reading the bit about "Java 9 has added List.of/Set.of methods that return an unmodifiable list/set containing an arbitrary number of elements" in your explanation, I looked at the documentation, and it doesn't seem to mention what an unmodifiable list is.
I mean, I know what it means in plain English, but what object is it? It mentions "The List instances created by these methods," but as I said above, you can't make an instance of an interface, right?