diff --git a/app/src/main/java/com/kunzisoft/keepass/database/element/PwGroup.kt b/app/src/main/java/com/kunzisoft/keepass/database/element/PwGroup.kt index dbbbca61a..50d94dca0 100644 --- a/app/src/main/java/com/kunzisoft/keepass/database/element/PwGroup.kt +++ b/app/src/main/java/com/kunzisoft/keepass/database/element/PwGroup.kt @@ -13,9 +13,9 @@ abstract class PwGroup private var titleGroup = "" @Transient - private val childGroups = LinkedHashMap, Group>() + private val childGroups = ArrayList() @Transient - private val childEntries = LinkedHashMap, Entry>() + private val childEntries = ArrayList() constructor() : super() @@ -32,9 +32,9 @@ abstract class PwGroup super.updateWith(source) titleGroup = source.titleGroup childGroups.clear() - childGroups.putAll(source.childGroups) + childGroups.addAll(source.childGroups) childEntries.clear() - childEntries.putAll(source.childEntries) + childEntries.addAll(source.childEntries) } override var title: String @@ -42,27 +42,31 @@ abstract class PwGroup set(value) { titleGroup = value } override fun getChildGroups(): MutableList { - return childGroups.values.toMutableList() + return childGroups } override fun getChildEntries(): MutableList { - return childEntries.values.toMutableList() + return childEntries } override fun addChildGroup(group: Group) { - this.childGroups[group.nodeId] = group + if (childGroups.contains(group)) + removeChildGroup(group) + this.childGroups.add(group) } override fun addChildEntry(entry: Entry) { - this.childEntries[entry.nodeId] = entry + if (childEntries.contains(entry)) + removeChildEntry(entry) + this.childEntries.add(entry) } override fun removeChildGroup(group: Group) { - this.childGroups.remove(group.nodeId) + this.childGroups.remove(group) } override fun removeChildEntry(entry: Entry) { - this.childEntries.remove(entry.nodeId) + this.childEntries.remove(entry) } override fun toString(): String {