'compare()' method can be used to compare primitives -> 'compare()' method can be used to compare numbers

This commit is contained in:
Tagir Valeev
2018-10-12 12:41:24 +07:00
parent 95f2337448
commit 35de5a903d
13 changed files with 13 additions and 13 deletions

View File

@@ -131,7 +131,7 @@
<localInspection groupPath="Java,Java language level migration aids" language="JAVA" shortName="Convert2Diamond" displayName="Explicit type can be replaced with &lt;&gt;"
groupKey="group.names.language.level.specific.issues.and.migration.aids7" groupBundle="messages.InspectionsBundle" enabledByDefault="true" level="WARNING"
implementationClass="com.intellij.codeInspection.ExplicitTypeCanBeDiamondInspection" />
<localInspection groupPath="Java" language="JAVA" shortName="UseCompareMethod" displayName="'compare()' method can be used to compare primitives"
<localInspection groupPath="Java" language="JAVA" shortName="UseCompareMethod" displayName="'compare()' method can be used to compare numbers"
groupKey="group.names.language.level.specific.issues.and.migration.aids" groupBundle="messages.InspectionsBundle" enabledByDefault="true" level="WARNING"
implementationClass="com.intellij.codeInspection.UseCompareMethodInspection" />
<localInspection groupPath="Java" language="JAVA" shortName="UnknownGuard" displayName="Unknown @GuardedBy field" groupKey="group.names.concurrency.annotation.issues" groupBundle="messages.InspectionsBundle"

View File

@@ -1,4 +1,4 @@
// "Fix all ''compare()' method can be used to compare primitives' problems in file" "true"
// "Fix all ''compare()' method can be used to compare numbers' problems in file" "true"
public class Test {
public void test(int a, int b) {
if(Integer.compare(a, b) > 0) {

View File

@@ -1,4 +1,4 @@
// "Fix all ''compare()' method can be used to compare primitives' problems in file" "true"
// "Fix all ''compare()' method can be used to compare numbers' problems in file" "true"
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

View File

@@ -1,4 +1,4 @@
// "Fix all ''compare()' method can be used to compare primitives' problems in file" "true"
// "Fix all ''compare()' method can be used to compare numbers' problems in file" "true"
public class Test {
public int test(String s1, String s2) {
int res = Integer.compare(s1.length(), s2.length());

View File

@@ -1,4 +1,4 @@
// "Fix all ''compare()' method can be used to compare primitives' problems in file" "true"
// "Fix all ''compare()' method can be used to compare numbers' problems in file" "true"
class Test {
public void test(String s1, String s2) {
int res;

View File

@@ -1,4 +1,4 @@
// "Fix all ''compare()' method can be used to compare primitives' problems in file" "true"
// "Fix all ''compare()' method can be used to compare numbers' problems in file" "true"
class Test {
public int test(String s1, String s2) {
return Integer.compare(s1.length(), s2.length());

View File

@@ -1,4 +1,4 @@
// "Fix all ''compare()' method can be used to compare primitives' problems in file" "true"
// "Fix all ''compare()' method can be used to compare numbers' problems in file" "true"
public class Test {
public void test(String s1, String s2) {
System.out.println(Integer.compare(s1.length(), s2.length()));

View File

@@ -1,4 +1,4 @@
// "Fix all ''compare()' method can be used to compare primitives' problems in file" "true"
// "Fix all ''compare()' method can be used to compare numbers' problems in file" "true"
public class Test {
public void test(int a, int b) {
if(((Integer)a).compa<caret>reTo(b) > 0) {

View File

@@ -1,4 +1,4 @@
// "Fix all ''compare()' method can be used to compare primitives' problems in file" "true"
// "Fix all ''compare()' method can be used to compare numbers' problems in file" "true"
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

View File

@@ -1,4 +1,4 @@
// "Fix all ''compare()' method can be used to compare primitives' problems in file" "true"
// "Fix all ''compare()' method can be used to compare numbers' problems in file" "true"
public class Test {
public int test(String s1, String s2) {
int res = new Integer(s1.length()).co<caret>mpareTo(s2.length());

View File

@@ -1,4 +1,4 @@
// "Fix all ''compare()' method can be used to compare primitives' problems in file" "true"
// "Fix all ''compare()' method can be used to compare numbers' problems in file" "true"
class Test {
public void test(String s1, String s2) {
int res;

View File

@@ -1,4 +1,4 @@
// "Fix all ''compare()' method can be used to compare primitives' problems in file" "true"
// "Fix all ''compare()' method can be used to compare numbers' problems in file" "true"
class Test {
public int test(String s1, String s2) {
if(s1.length() < s2.length()) {

View File

@@ -1,4 +1,4 @@
// "Fix all ''compare()' method can be used to compare primitives' problems in file" "true"
// "Fix all ''compare()' method can be used to compare numbers' problems in file" "true"
public class Test {
public void test(String s1, String s2) {
System.out.println(s1.<caret>length() < s2.length() ? -1 : s1.length() == s2.length() ? 0 : 1);