2 ms·
The field is final, not it’s contents. It’s not a ”final list” on that field, it’s a (mutable) list that is the final assignment of a field. Mutability or immu
by alkonaut 2y ago
The field is final, not it’s contents. It’s not a ”final list” on that field, it’s a (mutable) list that is the final assignment of a field.
Mutability or immutability is part of the type not the field so you have 4 combinations in total
List<T> list;
final List<T> list;
final ImmutableList<T> list;
ImmutableList<T> list;
And that’s not even considering whether each T in the list is mutable or not.