3 ms·
null is icky... In java's arrayList, you can't really tell if a cell hasn't been initialized or has the value "null."
by speek 17y ago
null is icky... In java's arrayList, you can't really tell if a cell hasn't been initialized or has the value "null."
- dkarl 17y ago<pedantry>There are no uninitialized values in Java. Reference values are initialized to null by default.</pedantry> I'm not sure how null makes your problem worse...? If you want a value meaning "this value hasn't been set by the program yet" then you'll have to specify a value for that purpose. The easiest thing is to just use null... unless null corresponds to a valid value for the type, in which case it seems fortunate that it's available to represent that value. I find null annoying when it doesn't correspond to any valid value for my type and I'm forced to check for it everywhere anyway.