diff --git a/core/src/processing/data/DoubleDict.java b/core/src/processing/data/DoubleDict.java index c8297df6e..e310b079e 100644 --- a/core/src/processing/data/DoubleDict.java +++ b/core/src/processing/data/DoubleDict.java @@ -3,6 +3,7 @@ package processing.data; import java.io.*; import java.util.HashMap; import java.util.Iterator; +import java.util.Map; import processing.core.PApplet; @@ -106,6 +107,20 @@ public class DoubleDict { } + public DoubleDict(Map incoming) { + count = incoming.size(); + keys = new String[count]; + values = new double[count]; + int index = 0; + for (Map.Entry e : incoming.entrySet()) { + keys[index] = e.getKey(); + values[index] = e.getValue(); + indices.put(keys[index], index); + index++; + } + } + + /** * @webref doubledict:method * @brief Returns the number of key/value pairs