2 ms·
Yeah, a more accurate title could have been: Java's verbosity is due to its API, not the underlying language. It's still somewhat interesting to me to decouple
by _delirium 17y ago
Yeah, a more accurate title could have been: Java's verbosity is due to its API, not the underlying language. It's still somewhat interesting to me to decouple the two, though. There are some things that are verbose and cumbersome in Java due to the way the language fundamentally works: for example, no anonymous functions means that if you want to pass a simple one-time-use function to sort, you have to create a whole new file with your sort functor. But the examples in this blog post could've been fixed by just having designed the API differently, or even had the same underlying API but added a set of convenience wrappers for the common cases.
- pvg 17y agoyou have to create a whole new file with your sort functor. You don't. You can use an inner class. An anonymous one, if you like. It's more verbose than your typical lambda expression but it's not 'a whole new file' by any stretch.
- _delirium 17y agoAh right, I'm not sure why that skipped my mind; I've even done that before. I suppose that adds to the general view of the linked post that Java-the-language isn't actually inherently that verbose, but the JVM APIs are.
- wolfgke 17y ago> for example, no anonymous functions means that if you want to pass a simple one-time-use function to sort, you have to create a whole new file with your sort functor. No you don't have to. Simply create an anonymous class deriving from your sort functor interface. With anonymous functions it would still be shorter, I have to admit. But it is less cumbersome than the way you suggest.