From c43266964bcc62683b183e47cc51367390d276f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20P=C3=A9rez?= Date: Thu, 18 Jul 2019 14:49:51 +0200 Subject: [PATCH] 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. --- app/src/processing/app/UpdateCheck.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/processing/app/UpdateCheck.java b/app/src/processing/app/UpdateCheck.java index 39c555069a1..5350c8fd609 100644 --- a/app/src/processing/app/UpdateCheck.java +++ b/app/src/processing/app/UpdateCheck.java @@ -66,14 +66,14 @@ public UpdateCheck(Base base) { 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)); }