Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class AccountCache {

// Personcode, List of accounts
HashMap<String, List<Account>> registry = new HashMap<>();
String[] keys;

public void load() {
List<Account> accounts = accountRepository.findAll();
Expand All @@ -30,6 +31,8 @@ public void load() {

registry.get(account.getOwner()).add(account);
}

keys = registry.keySet().toArray(new String[0]);
}

public Account getRandomForPerson(String personCode) {
Expand All @@ -42,7 +45,6 @@ public Account getRandomForPerson(String personCode) {
}

public Account getRandom() {
String[] keys = registry.keySet().toArray(new String[0]);
String randomKey = keys[random.nextInt(keys.length)];

return getRandomForPerson(randomKey);
Expand Down