Hmm, maybe I should have another blog for Java geeking. What happened was, I had an ArrayList<String> and for a variety of reasons I decided to turn it into a HashMap<String,String>. After I’d fixed everything up, I got the weirdest NullPointerException, and I traced it to a call that looked like (x is the HashMap)
if ((x.size() > 0) && x.get(0).equals(foo))
and somehow the compiler had decided that get(0) was a reasonable thing to do to a HashMap<String,String>. Uh, strong typing, anyone?


author · Dad
colophon · rights
picture of the day
June 09, 2005
· Technology (90 fragments)
· · Java (123 more)

By .

The opinions expressed here
are my own, and no other party
necessarily agrees with them.

A full disclosure of my
professional interests is
on the author page.

I’m on Mastodon!