re: Language Features: Best and Worst VIEW POST


Null-stuff operators like in C# return nullObject?.somefunction() ?? "this is nice sometimes".

I actually like Java because of it's ecosystem but I also like checked exceptions (by this point some would think I'm crazy). Working with C# for a while and .NET Core made me realise I actually miss forcing me to handle exceptions. I find myself adding more and more handlers to middleware because a lot of things I didn't expect and did not know handler was missing catch block for them so they ended up in catch exception -> 500 something happend block. I'm not sure about them but I definitely like them when building REST.

I like being able to extend class but it hides a lot of things sometimes and I find myself looking through files to see where the actual thing happend. But if used properly it's good.

Kotlin has data classes which to me sounded like a good feature but I did not like the way they are done in Kotlin so something like that would be good.

That's all I can think of now. Maybe I'll edit to include Ruby, Groovy and Scala stuff.


Definitely +1 for compile-time type checking. I really don't like dynamic typing. It feels messy to me.


Is this:

nullObject?.somefunction() ?? "this is nice sometimes"

...a ternary operator? Like

nullObject == null ? somefunction() : "this is nice sometimes" Java?


Yeah but you can chain it so it makes things a lot more readable:


a bit late but yeah.. Valentin answerd already but ?. checks for null and prevents null pointer exception and returns null for value but also ?? is null coalescing operator which in case something returns null takes right side value as in java ternary operator but this one's shorter so nullvaluestring ?? "somedefaultvalue" looks a bit prettier :D

code of conduct - report abuse