I need a mutable boolean field in Java (I will return this field via get* method later and it should be possible to modify this field).
Boolean doesn't work because there are no set* methods in the Boolean class (I would say that Boolean is immutable, you can only change the reference, but you can't change the object itself).
I guess I can use Boolean array of size 1. But probably there are more elegant solutions?
Why doesn't Java have such a simple thing?
isXXX
methods instead ofgetXXX
– HenriettahenrietteisXXX
is only for those primitiveboolean
s. We should stick togetXXX
for thoseBoolean
s. – Maidenhead