src/jdk.jpackage/share/native/libapplauncher/OrderedMap.h
branchJDK-8200758-branch
changeset 57455 f1290ca0fee6
parent 57194 9d5fccd97421
--- a/src/jdk.jpackage/share/native/libapplauncher/OrderedMap.h	Wed Jul 03 17:46:04 2019 -0400
+++ b/src/jdk.jpackage/share/native/libapplauncher/OrderedMap.h	Sun Jul 07 19:40:48 2019 -0400
@@ -89,6 +89,7 @@
 
     OrderedMap(const OrderedMap<key_type, mapped_type> &Value) {
         Append(Value);
+        FAllowDuplicates = Value.GetAllowDuplicates();
     }
 
     ~OrderedMap() {
@@ -99,6 +100,10 @@
         FAllowDuplicates = Value;
     }
 
+    bool GetAllowDuplicates() const {
+        return FAllowDuplicates;
+    }
+
     iterator begin() {
         return FList.begin();
     }
@@ -214,6 +219,32 @@
         return result;
     }
 
+    bool GetKey(int index, key_type &Value) {
+        if (index < 0 || index >= (int)FList.size()) {
+            return false;
+        }
+        container_type *item = FList.at(index);
+        if (item != NULL) {
+            Value = item->first;
+            return true;
+        }
+
+        return false;
+    }
+
+    bool GetValue(int index, mapped_type &Value) {
+        if (index < 0 || index >= (int)FList.size()) {
+            return false;
+        }
+        container_type *item = FList.at(index);
+        if (item != NULL) {
+            Value = item->second;
+            return true;
+        }
+
+        return false;
+    }
+
     mapped_type &operator[](key_type Key) {
         container_type* item = FMap[Key];
         assert(item != NULL);
@@ -227,6 +258,7 @@
 
     OrderedMap& operator= (OrderedMap &Value) {
         Clear();
+        FAllowDuplicates = Value.GetAllowDuplicates();
         Append(Value);
         return *this;
     }