And that is also why the antarctic has its name...because there are no bears there, just penguins.
In python, it would be 15 lines, and simple. No utils, factories, algorithms or singletons.
I imagine it could be done in more reasonable java than this, but could it really be done cleanly and compactly?
http://www.nhplace.com/kent/PS/Lambda.html
Languages are more than just syntax and semantics. There's also a whole culture that grows up around the language, a set of "best practices" and common idioms. And the one that's grown up around Java seems to value abstraction and design patterns and convoluted, overgeneralized solutions.
This doesn't apply to all Java code, of course. You can write lean Java just like you'd write lean C or lean Python. But a non-trivial amount of the Java jobs out there expect you to layer frameworks on top of frameworks and jump through an amazing number of hoops just to get something done.
When we see problems like this, it's right to ask questions about what the language design encourages its programmers to do. Additonally, languages have "personality" just like people do, and those personalities evolve with the user base of the language as they adapt to the language's environment.
The question of whether this type of code is more common in Java than say Python or Perl is empirical, and my gut says it is. Java is the commoditized, corporate language par excellence. The features it implements and the way it implements them have attracted the kinds of programmers who would write code like that. That's not to say that Java code forces its users to write code that is so inelegant. That's just to say that it creates incentives that often push toward ugly code. C++ does that too. On the other side, Python (to name one example) seems to set up its environment in such a way as to encourage pretty code.
There's no clear-cut good or bad here, only interesting trends in the code produced in various languages.
And indeed I also have a feeling that premature optimization and general architectual astronaucy are deemed very highly by Java folks.
Don't get me wrong - I think that JVM is a marvel. I could also find greater joy in writing COBOL for a living. (at least my coworkers wouldn't be rambling constantly about stuff that is wrong and don't matter).
Every book I've read on Java shows even the "Circle inherits from Shape" examples to be ridiculously overarchitected and encapsulated (I am aware of why they are this way for illustrative purposes, however).
But its a good idea to do some of this stuff where and WHEN its appropriate. You can design a space shuttle to go to the grocery store doesn't mean you should.
I have seen my fare share of useless hard to understand and over engineered code in C, Groovy, Java and Lisp
A good book about this by Joshua Kerievsky is Refactoring To Patterns he talks exactly about this, the dangers of using patterns and the dangers of not (yes he uses Java in his examples)