If you want something with a fixed size, what's wrong with an array?
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
posted 5 years ago
fred rosenberger wrote:If you want something with a fixed size, what's wrong with an array?
Nothing wrong with an array, I am still trying to figure out how to use an array with ArrayList<Integer>.
The following has a compile time warning, which is the best solution.
How to fix it?
Type safety: The expression of type ArrayList needs unchecked conversion to conform to ArrayList<Integer>
The following will fail to compile:
Type mismatch: cannot convert from ArrayList<Integer> to ArrayList<Integer> ArrayListTest.java ArrayListTest/src
The following code will get java.lang.NullPointerException.
Ruth Stout was famous for gardening naked. Just like this tiny ad: