Browse Source

Clean up creation of new integers

pull/559/head
TacoTheDank 4 years ago
parent
commit
891d96fe13
  1. 2
      app/src/main/java/org/transdroid/daemon/Priority.java
  2. 2
      app/src/main/java/org/transdroid/daemon/TorrentStatus.java
  3. 4
      app/src/main/java/org/transdroid/daemon/adapters/vuze/VuzeXmlOverHttpClient.java
  4. 4
      app/src/main/java/org/transdroid/daemon/task/SetTransferRatesTask.java

2
app/src/main/java/org/transdroid/daemon/Priority.java

@ -55,7 +55,7 @@ public enum Priority { @@ -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());
}
}

2
app/src/main/java/org/transdroid/daemon/TorrentStatus.java

@ -53,7 +53,7 @@ public enum TorrentStatus { @@ -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());
}
}

4
app/src/main/java/org/transdroid/daemon/adapters/vuze/VuzeXmlOverHttpClient.java

@ -232,8 +232,8 @@ public class VuzeXmlOverHttpClient { @@ -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();

4
app/src/main/java/org/transdroid/daemon/task/SetTransferRatesTask.java

@ -36,11 +36,11 @@ public class SetTransferRatesTask extends DaemonTask { @@ -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);
}
}

Loading…
Cancel
Save