DequeRules

SUGGESTION

Simplification

View source code on GitHub

Suppression

Disable all rules by adding -XepOpt:Refaster:NamePattern=^(?!DequeRules\$).* as compiler argument.

Table of contents
  1. DequeAddFirst
  2. DequeAddLast
  3. DequeRemoveFirst
  4. DequeOfferLast
  5. DequePollFirst
  6. DequeGetFirst
  7. DequePeekFirst
  8. DequeRemoveFirstOccurrence
  9. DequeIterator
  10. DequeDescendingIterator

DequeAddFirst

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DequeAddFirst") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DequeRules\$DequeAddFirst).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 void testDequeAddFirst() {
-  new ArrayDeque<String>().push("foo");
+  new ArrayDeque<String>().addFirst("foo");
 }

DequeAddLast

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DequeAddLast") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DequeRules\$DequeAddLast).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 void testDequeAddLast() {
-  new ArrayDeque<String>().add("foo");
+  new ArrayDeque<String>().addLast("foo");
   new LinkedList<String>().add("bar");
 }

DequeRemoveFirst

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DequeRemoveFirst") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DequeRules\$DequeRemoveFirst).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 ImmutableSet<String> testDequeRemoveFirst() {
-  return ImmutableSet.of(new ArrayDeque<String>(0).pop(), new ArrayDeque<String>(1).remove());
+  return ImmutableSet.of(
+      new ArrayDeque<String>(0).removeFirst(), new ArrayDeque<String>(1).removeFirst());
 }

DequeOfferLast

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DequeOfferLast") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DequeRules\$DequeOfferLast).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 boolean testDequeOfferLast() {
-  return new ArrayDeque<String>().offer("foo");
+  return new ArrayDeque<String>().offerLast("foo");
 }

DequePollFirst

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DequePollFirst") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DequeRules\$DequePollFirst).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 String testDequePollFirst() {
-  return new ArrayDeque<String>().poll();
+  return new ArrayDeque<String>().pollFirst();
 }

DequeGetFirst

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DequeGetFirst") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DequeRules\$DequeGetFirst).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 String testDequeGetFirst() {
-  return new ArrayDeque<String>().element();
+  return new ArrayDeque<String>().getFirst();
 }

DequePeekFirst

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DequePeekFirst") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DequeRules\$DequePeekFirst).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 String testDequePeekFirst() {
-  return new ArrayDeque<String>().peek();
+  return new ArrayDeque<String>().peekFirst();
 }

DequeRemoveFirstOccurrence

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DequeRemoveFirstOccurrence") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DequeRules\$DequeRemoveFirstOccurrence).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 boolean testDequeRemoveFirstOccurrence() {
-  return new ArrayDeque<>().remove("foo");
+  return new ArrayDeque<>().removeFirstOccurrence("foo");
 }

DequeIterator

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DequeIterator") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DequeRules\$DequeIterator).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 Iterator<String> testDequeIterator() {
-  return new ArrayDeque<String>().reversed().descendingIterator();
+  return new ArrayDeque<String>().iterator();
 }

DequeDescendingIterator

SUGGESTION

Simplification

Suppression

Suppress false positives by adding the suppression annotation @SuppressWarnings("DequeDescendingIterator") to the enclosing element.

Disable this rule by adding -XepOpt:Refaster:NamePattern=^(?!DequeRules\$DequeDescendingIterator).* as compiler argument.

Samples

Shows the difference in example code before and after the Refaster rule is applied.

 Iterator<String> testDequeDescendingIterator() {
-  return new ArrayDeque<String>().reversed().iterator();
+  return new ArrayDeque<String>().descendingIterator();
 }

Copyright © 2017-2026 Picnic Technologies BV