This project shows some examples on how to use the JEP286, the Local-Variable Type Inference, implemented on Java Version 10.
It's possible to use on primitive types:
vari = 10; // It's an intRefer to org.java10.examples.BasicExample class.
It's possible to use on Java API classes:
varhello = "Hello!";Refer to org.java10.examples.ObjectExample class.
It's possible to build developed objects:
varProduct = newProduct("Good Laptop", 1000f, 10f);Refer to org.java10.examples.ComplexObjectExample class.
It's possible to add a new method to existing class
varmodifiedProduct = newProduct("An internet product", 8f, 0.5f) {
publicfloatapplyInternetPrice() {
returngetPrice() - 1f + getTax();
}
};Refer to org.java10.examples.ProductExample class.
It's possible to mix interfaces.
varseaplane = (Navigable & Flyer) Vehicle::create;Refer to org.java10.examples.MixinExample class.