Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4082)

Issue 6333058: Package-private Enums.getUniverse (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 10 months ago by Louis Wasserman
Modified:
11 years, 10 months ago
Reviewers:
Chris Povirk
Visibility:
Public.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+247 lines, -0 lines) Patch
M guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/Platform.java View 1 chunk +4 lines, -0 lines 0 comments Download
A guava-tests/test/com/google/common/collect/EnumsTest.java View 1 chunk +40 lines, -0 lines 0 comments Download
A guava/src/com/google/common/collect/Enums.java View 1 chunk +127 lines, -0 lines 0 comments Download
M guava/src/com/google/common/collect/Platform.java View 2 chunks +76 lines, -0 lines 0 comments Download

Messages

Total messages: 1
Louis Wasserman
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.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b