Wednesday, January 27, 2010

Java!?!? NOT YOU TOO!?!?

ARGH!!! Why would a high-level language like Java behave like this!?!?

I dare any programmer to explain why this should be the preferred, or even expected, behavior.
I'm also slightly disappointed that Arrays.binarySearch() does not guarantee which value will be found in the case of multiple matches. I don't use Python, but the consistency provided by the bisect_left/right() algorithms is needed sometimes.

Oh well, at least sort() is guaranteed stable...
Also, why doesn't Math.min() do varargs? At least provide an overload for 3 arguments for my common DP needs!
I wonder if Java was the first language to allow an optional trailing comma in its array initializer syntax. It's a "feature" that I absolutely love, but I can see how that decision might've been contentious. // Nah, C has had it for a long time, apparently...
I need to get this book: Java Puzzlers: Traps, Pitfalls, and Corner Cases. I bet this shift behavior is in there somewhere. / Yep, Puzzle 27: Shifty i's.
I just found out that Java has non-short-circuiting boolean logical operators.

No comments:

Post a Comment