ImmutableSortedMapRules
SUGGESTION
Simplification
Suppression
Disable all rules by adding
-XepOpt:Refaster:NamePattern=^(?!ImmutableSortedMapRules\$).*as compiler argument.
Table of contents
ImmutableSortedMapOrderedBy
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("ImmutableSortedMapOrderedBy")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ImmutableSortedMapRules\$ImmutableSortedMapOrderedBy).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSortedMap.Builder<String, Integer> testImmutableSortedMapOrderedBy() {
- return new ImmutableSortedMap.Builder<>(Comparator.comparingInt(String::length));
+ return ImmutableSortedMap.orderedBy(Comparator.comparingInt(String::length));
}ImmutableSortedMapNaturalOrder
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("ImmutableSortedMapNaturalOrder")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ImmutableSortedMapRules\$ImmutableSortedMapNaturalOrder).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSortedMap.Builder<String, Integer> testImmutableSortedMapNaturalOrder() {
- return ImmutableSortedMap.orderedBy(Comparator.<String>naturalOrder());
+ return ImmutableSortedMap.naturalOrder();
}ImmutableSortedMapReverseOrder
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("ImmutableSortedMapReverseOrder")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ImmutableSortedMapRules\$ImmutableSortedMapReverseOrder).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSortedMap.Builder<String, Integer> testImmutableSortedMapReverseOrder() {
- return ImmutableSortedMap.orderedBy(Comparator.<String>reverseOrder());
+ return ImmutableSortedMap.reverseOrder();
}ImmutableSortedMapOf
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("ImmutableSortedMapOf")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ImmutableSortedMapRules\$ImmutableSortedMapOf).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSortedMap<String, Integer> testImmutableSortedMapOf() {
- return ImmutableSortedMap.<String, Integer>naturalOrder().buildOrThrow();
+ return ImmutableSortedMap.of();
}ImmutableSortedMapOfWithComparableAndObject
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("ImmutableSortedMapOfWithComparableAndObject")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ImmutableSortedMapRules\$ImmutableSortedMapOfWithComparableAndObject).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSortedMap<String, Integer> testImmutableSortedMapOfWithComparableAndObject() {
- return ImmutableSortedMap.<String, Integer>naturalOrder().put("foo", 1).buildOrThrow();
+ return ImmutableSortedMap.of("foo", 1);
}ImmutableSortedMapOfEntryGetKeyEntryGetValue
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("ImmutableSortedMapOfEntryGetKeyEntryGetValue")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ImmutableSortedMapRules\$ImmutableSortedMapOfEntryGetKeyEntryGetValue).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<ImmutableSortedMap<String, Integer>>
testImmutableSortedMapOfEntryGetKeyEntryGetValue() {
return ImmutableSet.of(
- ImmutableSortedMap.<String, Integer>naturalOrder().put(Map.entry("foo", 1)).buildOrThrow(),
- Stream.of(Map.entry("bar", 2))
- .collect(toImmutableSortedMap(Map.Entry::getKey, Map.Entry::getValue)));
+ ImmutableSortedMap.of(Map.entry("foo", 1).getKey(), Map.entry("foo", 1).getValue()),
+ ImmutableSortedMap.of(Map.entry("bar", 2).getKey(), Map.entry("bar", 2).getValue()));
}ImmutableSortedMapCopyOf
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("ImmutableSortedMapCopyOf")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ImmutableSortedMapRules\$ImmutableSortedMapCopyOf).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<ImmutableSortedMap<String, Integer>> testImmutableSortedMapCopyOf() {
return ImmutableSet.of(
- ImmutableSortedMap.copyOf(ImmutableSortedMap.of("foo", 1), naturalOrder()),
- ImmutableSortedMap.copyOf(ImmutableSortedMap.of("bar", 2).entrySet()),
- ImmutableSortedMap.<String, Integer>naturalOrder()
- .putAll(ImmutableSortedMap.of("baz", 3))
- .buildOrThrow(),
- ImmutableSortedMap.copyOf(Iterables.cycle(Map.entry("qux", 4)), naturalOrder()),
- ImmutableSortedMap.<String, Integer>naturalOrder()
- .putAll(ImmutableSortedMap.of("quux", 5).entrySet())
- .buildOrThrow(),
- Streams.stream(Iterables.cycle(Map.entry("corge", 6)))
- .collect(toImmutableSortedMap(Map.Entry::getKey, Map.Entry::getValue)),
- ImmutableSortedMap.of("grault", 7).entrySet().stream()
- .collect(toImmutableSortedMap(Map.Entry::getKey, Map.Entry::getValue)));
+ ImmutableSortedMap.copyOf(ImmutableSortedMap.of("foo", 1)),
+ ImmutableSortedMap.copyOf(ImmutableSortedMap.of("bar", 2)),
+ ImmutableSortedMap.copyOf(ImmutableSortedMap.of("baz", 3)),
+ ImmutableSortedMap.copyOf(Iterables.cycle(Map.entry("qux", 4))),
+ ImmutableSortedMap.copyOf(ImmutableSortedMap.of("quux", 5).entrySet()),
+ ImmutableSortedMap.copyOf(Iterables.cycle(Map.entry("corge", 6))),
+ ImmutableSortedMap.copyOf(ImmutableSortedMap.of("grault", 7).entrySet()));
}ToImmutableSortedMap
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("ToImmutableSortedMap")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ImmutableSortedMapRules\$ToImmutableSortedMap).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Collector<Integer, ?, ImmutableSortedMap<String, Double>> testToImmutableSortedMap() {
- return toImmutableSortedMap(naturalOrder(), String::valueOf, Double::valueOf);
+ return toImmutableSortedMap(String::valueOf, Double::valueOf);
}ToImmutableSortedMapWithBinaryOperator
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("ToImmutableSortedMapWithBinaryOperator")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!ImmutableSortedMapRules\$ToImmutableSortedMapWithBinaryOperator).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Collector<Integer, ?, ImmutableSortedMap<String, Double>>
testToImmutableSortedMapWithBinaryOperator() {
- return toImmutableSortedMap(naturalOrder(), String::valueOf, Double::valueOf, Double::sum);
+ return toImmutableSortedMap(String::valueOf, Double::valueOf, Double::sum);
}