mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-19 08:52:15 +01:00
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.
This commit is contained in:
parent
2e596c6eff
commit
c43266964b
@ -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));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user