Skip to content

Commit c432669

Browse files
Ivan-Perezcmaglie
authored andcommitted
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.
1 parent 2e596c6 commit c432669

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

app/src/processing/app/UpdateCheck.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ public UpdateCheck(Base base) {
6666
public void run() {
6767
//System.out.println("checking for updates...");
6868

69-
// generate a random id in case none exists yet
70-
Random r = new Random();
71-
long id = r.nextLong();
72-
69+
long id;
7370
String idString = PreferencesData.get("update.id");
7471
if (idString != null) {
7572
id = Long.parseLong(idString);
7673
} else {
74+
// generate a random id in case none exists yet
75+
Random r = new Random();
76+
id = r.nextLong();
7777
PreferencesData.set("update.id", String.valueOf(id));
7878
}
7979

0 commit comments

Comments
 (0)