Java: Missing Features
31–40 of 54 posts
Re: Java: Missing Features
#32> The issue of primitive specialisation of generics is only tangentially related to type erasure, and run-time visible generics are actually much less useful than Java folk wisdom insists. Run-time visible generics are pretty important because it lets us avoid boxing everything. In .NET, they don't have this problem, and as a result primitive dictionaries are ~17x faster [0]. Java folk wisdom seems pretty accurate to…
Re: Java: Missing Features
#33Some of these, like reified generics, would be great, and it's sad it's too late to add them to the JVM. Some of these, like more expressive imports, seem pretty pointless given that we use IDE's. But some of these are quite un-Javaish. Structural typing would really go against the grain of the language, and i have a very hard time believing it would actually be useful. What method name is currently widely used with…
ImmutableMap.of(Key, Value, Key, Value...);
For ones with more than 4 values you will need:
ImmutableMap WORD_TO_INT = new ImmutableMap.Builder() .put("one", 1) .put("two", 2) .put("three", 3) .build();
Re: Java: Missing Features
#34JVMLS 2015:
https://www.youtube.com/playlist?list=PLX8CzqL3ArzUo2dtMurvp...
Technical Keynote at JavaOne 2015
https://www.oracle.com/javaone/on-demand/index.html
Of course, first we still need to get Java 9.
And then when Java 10 with value types, reiffed generics, new FFI API, long Arrays is available, one can write blog posts about being forced to use Java 7 with these missing features on Android.
Re: Java: Missing Features
#35Things that would be good to add in Java are: - Collection and map literal. - Value type. - Multiple return values. - Destructure. - Pattern matching.
honest question - what would be real added value compared to dedicated wrapper type holding all you need for return?
Re: Java: Missing Features
#36Apart from primitive specialization the biggest omission in my opinion is the lack of value types ("structs"). It's almost impossible to write code that is heap allocation free or allows reasoning about cache locality.
Re: Java: Missing Features
#37Earlier quoted context omitted.
Play!Framework 2 for Java is awesome in this matter. You write public members, but at compilation it transforms them into private members with getters and setters (if not final). It means if you write the setter, it overrides the default one.
Lombok does the same ;)
Re: Java: Missing Features
#38The author of the article seems to be essentially looking for Kotlin (except for the structural typing part, which is a terrible idea and which Kotin thankfully ignored).
Re: Java: Missing Features
#39Earlier quoted context omitted.
might want to checkout lombok. https://projectlombok.org/
Just keep in mind that some of the features are a bit iffy. If you use their vals IntelliJ will syntax highlight it as an error in red for the simple reason that it's non-compliant with the Java language spec. Also, you'll usually need a new version on Lombok every time a new version of Java comes out, otherwise what used to compile with the previous java version will no longer compile. If you use the auto constructo…
Re: Java: Missing Features
#40Things that would be good to add in Java are: - Collection and map literal. - Value type. - Multiple return values. - Destructure. - Pattern matching.
that multiple return values got me interested. I can see this exploding complexity/unreadability of the code at first glance. honest question - what would be real added value compared to dedicated wrapper type holding all you need for return?
2. Tuples support pattern matching.
3. For simple cases the return type is clearer, no need to dig up another class declartion to figure out what the field types are.