From 891d96fe131c5e0906381c1baade4eb55e8f8e2d Mon Sep 17 00:00:00 2001 From: TacoTheDank Date: Fri, 10 Jul 2020 17:50:31 -0400 Subject: [PATCH] Clean up creation of new integers --- app/src/main/java/org/transdroid/daemon/Priority.java | 2 +- app/src/main/java/org/transdroid/daemon/TorrentStatus.java | 2 +- .../daemon/adapters/vuze/VuzeXmlOverHttpClient.java | 4 ++-- .../java/org/transdroid/daemon/task/SetTransferRatesTask.java | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/transdroid/daemon/Priority.java b/app/src/main/java/org/transdroid/daemon/Priority.java index 2e538c6a..32ad8c87 100644 --- a/app/src/main/java/org/transdroid/daemon/Priority.java +++ b/app/src/main/java/org/transdroid/daemon/Priority.java @@ -55,7 +55,7 @@ public enum Priority { } public int comparePriorityTo(Priority another) { - return new Integer(this.getCode()).compareTo(new Integer(another.getCode())); + return Integer.compare(this.getCode(), another.getCode()); } } diff --git a/app/src/main/java/org/transdroid/daemon/TorrentStatus.java b/app/src/main/java/org/transdroid/daemon/TorrentStatus.java index 3a190690..3c31a444 100644 --- a/app/src/main/java/org/transdroid/daemon/TorrentStatus.java +++ b/app/src/main/java/org/transdroid/daemon/TorrentStatus.java @@ -53,7 +53,7 @@ public enum TorrentStatus { } public int compareStatusCodeTo(TorrentStatus another) { - return new Integer(this.getCode()).compareTo(new Integer(another.getCode())); + return Integer.compare(this.getCode(), another.getCode()); } } diff --git a/app/src/main/java/org/transdroid/daemon/adapters/vuze/VuzeXmlOverHttpClient.java b/app/src/main/java/org/transdroid/daemon/adapters/vuze/VuzeXmlOverHttpClient.java index 481311bc..dfe909fc 100644 --- a/app/src/main/java/org/transdroid/daemon/adapters/vuze/VuzeXmlOverHttpClient.java +++ b/app/src/main/java/org/transdroid/daemon/adapters/vuze/VuzeXmlOverHttpClient.java @@ -232,8 +232,8 @@ public class VuzeXmlOverHttpClient { serializer.startTag(null, TAG_CONNECTION_ID).text(connectionID.toString()).endTag(null, TAG_CONNECTION_ID); } // set request id, which for this purpose is always a random number - Integer randomRequestID = new Integer(random.nextInt()); - serializer.startTag(null, TAG_REQUEST_ID).text(randomRequestID.toString()).endTag(null, TAG_REQUEST_ID); + int randomRequestID = random.nextInt(); + serializer.startTag(null, TAG_REQUEST_ID).text(Integer.toString(randomRequestID)).endTag(null, TAG_REQUEST_ID); serializer.endTag(null, TAG_REQUEST); serializer.endDocument(); diff --git a/app/src/main/java/org/transdroid/daemon/task/SetTransferRatesTask.java b/app/src/main/java/org/transdroid/daemon/task/SetTransferRatesTask.java index 5f4a4a9b..33c27dbf 100644 --- a/app/src/main/java/org/transdroid/daemon/task/SetTransferRatesTask.java +++ b/app/src/main/java/org/transdroid/daemon/task/SetTransferRatesTask.java @@ -36,11 +36,11 @@ public class SetTransferRatesTask extends DaemonTask { public Integer getUploadRate() { int uploadRate = extras.getInt("UPLOAD_RATE"); - return (uploadRate == -1 ? null : new Integer(uploadRate)); + return (uploadRate == -1 ? null : uploadRate); } public Integer getDownloadRate() { int downloadRate = extras.getInt("DOWNLOAD_RATE"); - return (downloadRate == -1 ? null : new Integer(downloadRate)); + return (downloadRate == -1 ? null : downloadRate); } }