by jimofl · 11mo ago · 0 comments
As old as Java’s Enum is, I think it’s absolutely fantastic. I just wanted to increase its fantastic-ness!
Meaning, instead of having to instrument each enum class, you could have
MyEnumHelper.of(AnyEnum.class)
.whateverFunctionalityYouWant()
where the of() implementation uses ClassValue to store the cached data.The high value of your response, to me, is discovering I can replace my custom "Memoizer" mechanism with a platform-provided (and therefore superior to my custom code) solution with java.lang.ClassValue.
Tysvm for posting, and in detail.