It might seem a bit early to start speculating about Java 10 before Java9 has even launched. There are hints about Java 10 Features ……
First one in the list is Value Type
Values types could bridge the gap between
primitive data type and
Object, providing an intermediate ‘object’ which combines most of the benefits of Objects and primitives.
- Two Value Types would be
compared by fieldsdirectly, even for == checks, much like primitive types.
- The ValueType variables are entirely
copied when passing them as a parameter to a function, rather than typically just getting a copy of the reference to an object. This allows you to treat a small object as if it were a value type like int or boolean.
“Value Type is highly-efficient small ‘objects’ without inheritance”.
Small object means it should be used for objects that only have a few fields, as the whole content of the object is going to be copied repeatedly when we pass Value Type objects to function. Large objects would be better served with passes by reference.
Without Inheritance means that you won’t be able to use polymorphism for Value Type objects. Because Value Types are meant to be stored directly, like primitive values, they don’t include any class information, so the JVM must always be able to infer what the object is from the program itself, instead of from any information on the object.
More Features to Follow in next post. Do comment and subscribe.
ALSO READ :- Java9 Features | JSHELL | Try with Resource.
ALSO READ :- Difference in Interface of JAVA7,8,9
ALSO READ :-As a software engineer, what’s the best skill set to have for the next 5-10 years?