Essentially, the goal is to provide a safe, transparent, package-private way to mirror the tricks ...
11 years, 10 months ago
(2012-06-23 10:21:42 UTC)
#1
Essentially, the goal is to provide a safe, transparent, package-private way to
mirror the tricks used by EnumSet and EnumMap to get access to the shared array
of enum constants held in their Class object. On supported platforms -- that
is, wherever we can get the JavaLangAccess interface to the Java internals --
Enums.getUniverse runs in constant time, independent of the number of enum
values.
Ideally, this can be used to reimplement enum collection magic without going
through EnumSet or EnumMap. For example, EnumMultiset could be implemented with
the ImmutableList<E> and an int[], avoiding the per-element Count object
allocations.
Issue 6333058: Package-private Enums.getUniverse
(Closed)
Created 11 years, 10 months ago by Louis Wasserman
Modified 11 years, 10 months ago
Reviewers: Chris Povirk
Base URL:
Comments: 0