News for hackers. Stuff that matters.
Re:Stop casting to List (Java) by haglin on Thursday February 15, 2018 @11:34AM (#16385326)
If you use LinkedList and ArrayList in an API, you can't pass a list created by the following factory methods:

Collections.emptyList() Collections.singletonList() Collections.unmodifiableList() List.of()

As niftich points out, use the marker interface java.util.RandomAccess, if you want to know if the list allows constant time access.

There are no comments on this comment yet.