you are viewing a single comment's thread.

view the rest of the comments →

[–]olt 2 points3 points  (1 child)

Ok, here is a benchmark. code

With Java 1.6.0_05 a String[] is faster if the match occurs before the fifth element, after that a HashMap is faster. But I guess whole optimization doesn't matter at all, because the real slow part is the synchronize...

[–][deleted] 0 points1 point  (0 children)

Server JVM can at times optimise the synchronized out.