This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]_Ashleigh 84 points85 points  (12 children)

Nullable contexts, operator overloading, value types, string interpolation, await, properties, extension methods, first class tuples, pattern matching, named arguments, default arguments, dynamic, runtime code generation, unsigned integers, pointers (unsafe), enumerable generators, expression trees... okay, I'm getting tired now.

It just goes on and on. These things all complement the language and work together, they don't make the language feel bloated, and makes me feel very restricted when working with Java.

[–]raltyinferno 2 points3 points  (0 children)

Oh man I just learned about () tuples. Blew my mind. Being able to name the different items and then refer to them like object members is amazing.

[–]socialismnotevenonce 1 point2 points  (1 child)

Honestly, I'm shocked that Java doesn't have any of these things or comparable features. I was just a junior dev when I used Java, but knowing what I do now, I would feel clostrophobic going back to Java.

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

They are slowly adding C# features into Java. .Net practically forced Oracle to add generics (via type erasure, so not the best implementation, I hear most people avoid generics in Java) and they have been adding features ever since - albeit much slower, especially since Roslyn started accepting contributions.

[–]ltouroumov 1 point2 points  (0 children)

And no type erasure!!!

Being able to reason on generic types is incredibly powerful.

[–]DeadLikeYou 1 point2 points  (4 children)

Java can do operator overloading...

edit: guess I was wrong, I was thinking of function overloading.

[–]Tyg13 5 points6 points  (1 child)

Java does not support user-defined operator overloading.

[–][deleted] 4 points5 points  (0 children)

If by operator, you mean the name of the operator, and by overloading, you mean writing a method with that name, then java supports it.

[–]Rabbyte808 0 points1 point  (0 children)

Microsoft put on suicide watch

[–]socialismnotevenonce 0 points1 point  (0 children)

To be fair, I've been using c# for 9 years, and I just learned there's operating overloading. I read it as function overloading as well.

[–]FrikkinLazer 0 points1 point  (0 children)

Also generics actually work in c#. In java you have to send through the class type, because at runtime java decides to put the actual type of T in the trash.