Fix the old account isn't replaced when adding a same account
This commit is contained in:
@@ -152,8 +152,9 @@ public class AddAccountPane extends StackPane {
|
||||
Accounts.getAccounts().add(account);
|
||||
} else {
|
||||
// adding an already-added account
|
||||
// instead of discarding the new account, we replace the existing account with the new account
|
||||
Accounts.getAccounts().set(oldIndex, account);
|
||||
// instead of discarding the new account, we first remove the existing one then add the new one
|
||||
Accounts.getAccounts().remove(oldIndex);
|
||||
Accounts.getAccounts().add(oldIndex, account);
|
||||
}
|
||||
acceptPane.hideSpinner();
|
||||
fireEvent(new DialogCloseEvent());
|
||||
|
||||
@@ -22,7 +22,7 @@ import static javafx.collections.FXCollections.unmodifiableObservableList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -75,7 +75,7 @@ public final class MappedObservableList {
|
||||
@Override
|
||||
public void onChanged(Change<? extends T> change) {
|
||||
// cache removed elements to reduce calls to mapper
|
||||
Map<T, LinkedList<U>> cache = new HashMap<>();
|
||||
Map<T, LinkedList<U>> cache = new IdentityHashMap<>();
|
||||
|
||||
while (change.next()) {
|
||||
int from = change.getFrom();
|
||||
|
||||
Reference in New Issue
Block a user