I got in a fight, mentally. I love generics, but a lot of the times when I get my code review’s occur, people ask me why I didn’t use an object array when it would have sufficed?
So in this, I am talking about instead of using this:
ArrayList list = new ArrayList();
It’s a good question I suppose, but I gotta admit, I favor the use of generics heavily, and although there is a load of piddly crap that could be brought up between the two, I think that it all boils down to the performance differences, from both doing the development (since you don’t have to copy to an external collection to make freakin updates) to running the god damn application itself. I have heard in the past that there have been compiler problems with this generics. Is this true? I have no clue. I would be interested to know if it was though. Anyways, why do I think that generics are better then object arrays performance wise. It basically boils down to the heap. In the end, a generic from what I understand, there is no boxing and reference created to the boxed value, which is the case with an object array, and therefore, because of this lack of creating a piece of allocated memory on the heap instead just puts the god damn value in the array. That makes better sense to me.
I could point out more, but I want to leave work now.