diff options
author | Iván Pérez <Ivan-Perez@users.noreply.github.com> | 2019-07-18 15:49:51 +0300 |
---|---|---|
committer | Cristian Maglie <c.maglie@bug.st> | 2019-09-16 12:42:43 +0300 |
commit | c43266964bcc62683b183e47cc51367390d276f4 (patch) | |
tree | fcc827a8589f6dfacaf12455b67ed1cba70df103 | |
parent | 2e596c6effac5c8f4141330e2db8bacc80c7755c (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.java | 8 |
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)); } |