Skip to content
Permalink
Browse files
Use java API compare instead of do it manual. (#285)
  • Loading branch information
arturobernalg committed Apr 22, 2022
1 parent 6acb471 commit 53618e3d7304c6ffb0abfcb050ce445d86a3b08e
Showing 3 changed files with 5 additions and 16 deletions.
@@ -29,13 +29,7 @@ public CPInt(final int theInt) {

@Override
public int compareTo(final Object obj) {
if (theInt > ((CPInt) obj).theInt) {
return 1;
}
if (theInt == ((CPInt) obj).theInt) {
return 0;
}
return -1;
return Integer.compare(theInt, ((CPInt) obj).theInt);
}

public int getInt() {
@@ -29,13 +29,7 @@ public CPLong(final long theLong) {

@Override
public int compareTo(final Object obj) {
if (theLong > ((CPLong) obj).theLong) {
return 1;
}
if (theLong == ((CPLong) obj).theLong) {
return 0;
}
return -1;
return Long.compare(theLong, ((CPLong) obj).theLong);
}

public long getLong() {
@@ -22,6 +22,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TreeSet;

@@ -157,8 +158,8 @@ public IcTuple(final CPClass C, final int F, final CPClass C2, final CPUTF8 N) {
public boolean equals(final Object o) {
if (o instanceof IcTuple) {
final IcTuple icT = (IcTuple) o;
return C.equals(icT.C) && F == icT.F && (C2 != null ? C2.equals(icT.C2) : icT.C2 == null)
&& (N != null ? N.equals(icT.N) : icT.N == null);
return C.equals(icT.C) && F == icT.F && (Objects.equals(C2, icT.C2))
&& (Objects.equals(N, icT.N));
}
return false;
}

0 comments on commit 53618e3

Please sign in to comment.