(Disclosure: I hate Java)
(Disclosure: I hate Java)
- lambdas
- Expression trees
- sensible operator overloading
- value type semantics (you can define your own types that behave like primitives)
- reified generics instead of type erasure, which means that you can have an <int,int> table (just two ints instead two pointers to Integer)
- "async monad" baked into the syntax
On the other hand, Java wins easily on the open source lib count
Yes, the CLR gets a major advantage by having a better bytecode language design, but it can't be the real reason Java didn't get lambdas until Java 8.
That being said, Java broke other things along the way back then, if I remember correctly, so in hindsight type erasure for fake generics was maybe not the smartest choice.
C# is a streamlined platform that is designed to work with Microsoft's platforms and tools. If you use what Microsoft has to offer (Visual Studio, Windows, NuGet, IIS, ASP.NET MVC) and some of the really well-maintained OSS packages, you'll have a great experience. Bad news is: you don't get a lot of freedom in terms of platform choice.
Java is a broad platform that comes in thousands of different flavors; there are tons of mature, well-maintained options for just about everything from web framework to IDE to build tool and so forth. The problem is: everyone does everything their own way, so you kind of have to jerryrig everything yourself. Java can feel really janky, but you have a ton of options.
disclosure: I'm ex-Microsoft and LOVE .NET, but I feel that I need to know the JVM better in order to work on some of the projects I love.
[1]: I'm porting my OS X window manager (https://github.com/sdegutis/zephyros) to Windows.