package org.cafebabepy.runtime.object.java;

import org.cafebabepy.runtime.PyObject;
import org.cafebabepy.runtime.Python;
import org.cafebabepy.runtime.object.AbstractPyObjectObject;

import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * Created by yotchang4s on 2017/06/19.
 */
public class PyDictObject extends AbstractPyObjectObject {

    private Map<PyObject, PyObject> map;

    public PyDictObject(Python runtime) {
        this(runtime, Collections.synchronizedMap(new LinkedHashMap<>()));
    }

    public PyDictObject(Python runtime, Map<PyObject, PyObject> map) {
        super(runtime);

        this.map = map;
    }

    public Map<PyObject, PyObject> getMap() {
        return Collections.unmodifiableMap(this.map);
    }

    public Map<PyObject, PyObject> getRawMap() {
        return this.map;
    }

    @Override
    public PyObject getType() {
        return this.runtime.typeOrThrow("builtins.dict");
    }

    @Override
    @SuppressWarnings("unchecked")
    public <T> T toJava(Class<T> clazz) {
        if (clazz == Map.class) {
            return (T) new LinkedHashMap<>(this.map);
        }

        return super.toJava(clazz);
    }
}

@@ -1074,16 +1074,122 @@
 clazz ==
+ LinkedHashMap.class) %7B%0A            return (T) new LinkedHashMap%3C%3E(this.map);%0A%0A        %7D else if (clazz ==
  Map.cla

Add LinkedHashMap to toJava of dict object