In your three examples, memory optimization actually happens, because with empty Collectionyou use a subset of the class’s behavior, without relying on any that depend on the parameterized type, you can reuse the raw instance.
emptyList()
private static <T> List<T> emptyList() {
return new EmptyList<T>();
}
: Collections.emptyList() == Collections.emptyList() false.
, , , , - " , , ", .