4 ms·
Yes, final is only 'shallow immutability' and only ensures that the reference itself is immutable. This is the only part that applies to closures though: the re
by RyanZAG 13y ago
Yes, final is only 'shallow immutability' and only ensures that the reference itself is immutable. This is the only part that applies to closures though: the reference that is accessible from the closure.
Full immutability is left up to the programmer / api designer as with javascript - as it should be, imo. Trying to optimize fully immutable data-structures when performance becomes an issue in an inner loop down the line is a nightmare I would not recommend.