Monday, June 9, 2008

Java Collections Hell

I've been doing some coding in the bowels of JBoss J2EE system. One of those day I'll write a Daily WTF post on the wonders of 6-layer system that takes 5 people to adjust anything. For now, I just wanted to mention this particular piece of Java Hell.


void addList(List list)
{
// do stuff
}

void doValuation(List instruments, int[] thingsToCompute)
{
addList(instruments);
addList(Arrays.asList(thingsToCompute));
}

Here is the question: what gets passed to the addList in the second call?


List? Silly you. Compilation Error? How dare you!

List

Nice Java!

No comments: