Generic specialization

Generic specialization is, perhaps, a bit easier to understand. Currently, generic type variables can hold only reference types. For example, you can create a List<Integer>, but not a List<int>. There are some pretty complex reasons why this is so, but being able to use primitives, and value types, would make collections more efficient in terms of memory and computation. You can read more about this feature in this document from, again, Brian Goetz--http://cr.openjdk.java.net/~briangoetz/valhalla/specialization.html. Jesper de Jong also has a good write-up about the complexities of primitives in generic type variables here:

http://www.jesperdj.com/2015/10/12/project-valhalla-generic-specialization/

Get Java 9: Building Robust Modular Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.