Skip to Content
Java 9: Building Robust Modular Applications
book

Java 9: Building Robust Modular Applications

by Dr. Edward Lavieri, Peter Verhas, Jason Lee
April 2018
Intermediate to advanced content levelIntermediate to advanced
910 pages
33h 21m
English
Packt Publishing
Content preview from Java 9: Building Robust Modular Applications

Enhanced enums

Enhanced enums will augment the expressiveness of the enum construct in the Java Language by allowing type-variables in enums (generic enums), and performing sharper type-checking for enum constants. (http://openjdk.java.net/jeps/301). What this means is that enums will finally support a parameterized type, allowing something like this (taken from the JEP at the link mentioned previously):

 enum Primitive<X> { INT<Integer>(Integer.class, 0) { int mod(int x, int y) { return x % y; } int add(int x, int y) { return x + y; } }, FLOAT<Float>(Float.class, 0f) { long add(long x, long y) { return x + y; } }, ... ; final Class<X> boxClass; final X defaultValue; Primitive(Class<X> boxClass, X defaultValue) { this.boxClass = boxClass; ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java 9 High Performance

Java 9 High Performance

Mayur Ramgir, Nick Samoylov
Distributed Computing in Java 9

Distributed Computing in Java 9

Raja Malleswara Rao Malleswara Rao Pattamsetti

Publisher Resources

ISBN: 9781788832823Supplemental ContentOtherPurchase LinkErrata Page