0

I want to declare a cache like this LoadingCache<EnumKeys, Map<String,String>> in Guava. Can we have enum as keys in guava? When we create Map for enum we use EnumHasMap. Does something similar exist for Guava too?

1 Answers1

2

An Enum is still an Object, so yes, you can definitely use them as keys for a LoadingCache (and they have the advantage of being immutable, which is essential for keys).

However, there's only one implementation of LoadingCache.

Frank Pavageau
  • 11,477
  • 1
  • 43
  • 53