MultimapRules
SUGGESTION
Simplification
Suppression
Disable all rules by adding
-XepOpt:Refaster:NamePattern=^(?!MultimapRules\$).*
as compiler argument.
Table of contents
MultimapKeySet
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MultimapKeySet")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!MultimapRules\$MultimapKeySet).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Set<String> testMultimapKeySet() {
- return ImmutableSetMultimap.of("foo", "bar").asMap().keySet();
+ return ImmutableSetMultimap.of("foo", "bar").keySet();
}
MultimapSize
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MultimapSize")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!MultimapRules\$MultimapSize).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
int testMultimapSize() {
- return ImmutableSetMultimap.of().values().size();
+ return ImmutableSetMultimap.of().size();
}
MultimapGet
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MultimapGet")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!MultimapRules\$MultimapGet).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Collection<Integer>> testMultimapGet() {
return ImmutableSet.of(
- ImmutableSetMultimap.of(1, 2).asMap().get(1),
- Multimaps.asMap((Multimap<Integer, Integer>) ImmutableSetMultimap.of(1, 2)).get(1));
+ ImmutableSetMultimap.of(1, 2).get(1),
+ ((Multimap<Integer, Integer>) ImmutableSetMultimap.of(1, 2)).get(1));
}