woensdag 14 november 2007

autocasting can be confusing

since java 1.5 there is a very easy autocasting for primitive datatypes to handle them as an object using the wrapper class.

An example:
List aList = new ArrayList();
aList.add(1);
aList.add(new Integer(2));


Now what when we want to delete one of these objects, it will think we give an index as parameter instead of the object we want to delete. So when deleting remember to use the wrapper class.

Geen opmerkingen:

Een reactie plaatsen