Skip to content

I20240806-1800

@HannesWell HannesWell tagged this 06 Aug 18:24
The list current returned by
JavaCore.getAllJavaSourceVersionsSupportedByCompiler()
is mainly/only used to either fetch the first or
last element or test if a version-String is contained.

Especially for the last operation a Set is a better choice regarding
runtime. A SortedSet additionally also offers the methods
first()/last(), which are semantically more expressive than calling
List.get(0)/List.get(List.size()-1).

Furthermore using a SortedSet would also better reflect the general
semantic of the returned collection and element-access is usually not of
interest.
Assets 2
Loading