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() {
|
public void run() {
|
||||||
//System.out.println("checking for updates...");
|
//System.out.println("checking for updates...");
|
||||||
|
|
||||||
// generate a random id in case none exists yet
|
long id;
|
||||||
Random r = new Random();
|
|
||||||
long id = r.nextLong();
|
|
||||||
|
|
||||||
String idString = PreferencesData.get("update.id");
|
String idString = PreferencesData.get("update.id");
|
||||||
if (idString != null) {
|
if (idString != null) {
|
||||||
id = Long.parseLong(idString);
|
id = Long.parseLong(idString);
|
||||||
} else {
|
} else {
|
||||||
|
// generate a random id in case none exists yet
|
||||||
|
Random r = new Random();
|
||||||
|
id = r.nextLong();
|
||||||
PreferencesData.set("update.id", String.valueOf(id));
|
PreferencesData.set("update.id", String.valueOf(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user