Skip to content

Commit

Permalink
use description as map key
Browse files Browse the repository at this point in the history
  • Loading branch information
tomcz committed Mar 3, 2024
1 parent 399f199 commit 8335844
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/java/com/tomczarniecki/jpasskeep/MainListModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,16 @@ public MainListModel(List<Entry> entries) {
this.filtered = new ArrayList<>();
this.entries = new TreeMap<>();
for (Entry entry : entries) {
if (this.entries.containsKey(entry.getDescription())) {
Entry current = this.entries.get(entry.getDescription());
String key = entry.getDescription();
if (this.entries.containsKey(key)) {
Entry current = this.entries.get(key);
String notes = current.getNotes();
notes += "\n--Merged--\n" + entry.getUsername();
notes += "\n" + entry.getPassword();
notes += "\n" + entry.getNotes();
current.setNotes(notes);
} else {
this.entries.put(entry.getDescription(), entry);
this.entries.put(key, entry);
}
}
filter();
Expand Down

0 comments on commit 8335844

Please sign in to comment.