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();
}
MultimapIsEmpty
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MultimapIsEmpty")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!MultimapRules\$MultimapIsEmpty).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Boolean> testMultimapIsEmpty() {
return ImmutableSet.of(
- ImmutableSetMultimap.of("foo", 1).keySet().isEmpty(),
- ImmutableSetMultimap.of("bar", 2).keys().isEmpty(),
- ImmutableSetMultimap.of("baz", 3).values().isEmpty(),
- ImmutableSetMultimap.of("qux", 54).entries().isEmpty());
+ ImmutableSetMultimap.of("foo", 1).isEmpty(),
+ ImmutableSetMultimap.of("bar", 2).isEmpty(),
+ ImmutableSetMultimap.of("baz", 3).isEmpty(),
+ ImmutableSetMultimap.of("qux", 54).isEmpty());
}
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();
}
MultimapContainsKey
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MultimapContainsKey")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!MultimapRules\$MultimapContainsKey).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<Boolean> testMultimapContainsKey() {
return ImmutableSet.of(
- ImmutableSetMultimap.of("foo", 1).keySet().contains("bar"),
- ImmutableSetMultimap.of("baz", 1).keys().contains("qux"));
+ ImmutableSetMultimap.of("foo", 1).containsKey("bar"),
+ ImmutableSetMultimap.of("baz", 1).containsKey("qux"));
}
MultimapContainsValue
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MultimapContainsValue")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!MultimapRules\$MultimapContainsValue).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
boolean testMultimapContainsValue() {
- return ImmutableSetMultimap.of("foo", 1).values().contains(2);
+ return ImmutableSetMultimap.of("foo", 1).containsValue(2);
}
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));
}
MultimapKeysStream
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MultimapKeysStream")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!MultimapRules\$MultimapKeysStream).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Stream<String> testMultimapKeysStream() {
- return ImmutableSetMultimap.of("foo", 1).entries().stream().map(Map.Entry::getKey);
+ return ImmutableSetMultimap.of("foo", 1).keys().stream();
}
MultimapValuesStream
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("MultimapValuesStream")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!MultimapRules\$MultimapValuesStream).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Stream<Integer> testMultimapValuesStream() {
- return ImmutableSetMultimap.of("foo", 1).entries().stream().map(Map.Entry::getValue);
+ return ImmutableSetMultimap.of("foo", 1).values().stream();
}