Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/arduino/Arduino.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIván Pérez <Ivan-Perez@users.noreply.github.com>2019-07-18 15:49:51 +0300
committerCristian Maglie <c.maglie@bug.st>2019-09-16 12:42:43 +0300
commitc43266964bcc62683b183e47cc51367390d276f4 (patch)
treefcc827a8589f6dfacaf12455b67ed1cba70df103
parent2e596c6effac5c8f4141330e2db8bacc80c7755c (diff)
UpdateCheck microoptimization
No need to create a `Random` object and get a random ID from it if then it's overwritten with the stored value.
-rw-r--r--app/src/processing/app/UpdateCheck.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/src/processing/app/UpdateCheck.java b/app/src/processing/app/UpdateCheck.java
index 39c555069..5350c8fd6 100644
--- a/app/src/processing/app/UpdateCheck.java
+++ b/app/src/processing/app/UpdateCheck.java
@@ -66,14 +66,14 @@ public class UpdateCheck implements Runnable {
public void run() {
//System.out.println("checking for updates...");
- // generate a random id in case none exists yet
- Random r = new Random();
- long id = r.nextLong();
-
+ long id;
String idString = PreferencesData.get("update.id");
if (idString != null) {
id = Long.parseLong(idString);
} else {
+ // generate a random id in case none exists yet
+ Random r = new Random();
+ id = r.nextLong();
PreferencesData.set("update.id", String.valueOf(id));
}