Is there something in Guava that allows me to get the inverse of a Multimap as a (non-multi-) Map?
Consider the following:
static final ImmutableMap<Token, Integer> precedences =
new ImmutableSetMultimap.Builder<Integer, Token>()
.put(0, NOT)
.put(1, ASSIGN)
.put(2, OR)
.put(3, AND)
.putAll(4, NOT_EQUAL, EQUALS)
.putAll(5, LESS_EQUAL, LESS, GREATER_EQUAL, GREATER)
.putAll(6, ADD, SUB)
.putAll(7, MUL, DIV, MOD).build().inverse();
The problem is that the inverse()
is a Multimap again, and not a Map. Is there something in Guava that does the conversion for me or do I have to roll my own utility function?