IDEA-133322 Add an intention to convert compareTo(x)==0 to equals

This commit is contained in:
Dmitry Batkovich
2014-11-24 13:21:18 +03:00
parent 3781bd3aca
commit 38353bfac4
11 changed files with 310 additions and 0 deletions
@@ -0,0 +1,13 @@
import java.lang.Integer;
import java.lang.String;
class X {
void m() {
Integer i1 = new Integer(0);
Integer i2 = new Integer(2);
boolean b = i1.compareT<caret>o(i2) == 0;
}
}
@@ -0,0 +1,13 @@
import java.lang.Integer;
import java.lang.String;
class X {
void m() {
Integer i1 = new Integer(0);
Integer i2 = new Integer(2);
boolean b = i1.equals(i2);
}
}
@@ -0,0 +1,9 @@
import java.lang.String;
class X {
void m() {
boolean b = "asd".substring(1).compareTo("qwe".substring(2)) !<caret>= 0;
}
}
@@ -0,0 +1,9 @@
import java.lang.String;
class X {
void m() {
boolean b = !"asd".substring(1).equals("qwe".substring(2));
}
}
@@ -0,0 +1,9 @@
import java.lang.String;
class X {
void m() {
boolean b = "asd".compareTo("qwe") == 1;
}
}