List.of() or Collections.emptyList()

Collections.emptyList() does not need to create a new object for each call; it’s typical, as in OpenJDK, to just return the singleton EMPTY_LIST object. Additionally, it’s clearer that you intend to mean an empty list rather than having forgotten to fill in a placeholder.

Use emptyList(); it’s both faster (up to Java target level 1.9) and more readable.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)