'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
@@ -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) {
@@ -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;
@@ -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());
@@ -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;
@@ -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());
@@ -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()));
@@ -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) {
@@ -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;
@@ -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());
@@ -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;
@@ -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()) {
@@ -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);