Example usage for com.badlogic.gdx.utils IntMap entries

List of usage examples for com.badlogic.gdx.utils IntMap entries

Introduction

In this page you can find the example usage for com.badlogic.gdx.utils IntMap entries.

Prototype

public Entries<V> entries() 

Source Link

Document

Returns an iterator for the entries in the map.

Usage

From source file:com.kotcrab.vis.editor.serializer.cloner.IntMapCloner.java

License:Apache License

@Override
protected IntMap cloneObject(IntMap original, IDeepCloner cloner, Map<Object, Object> clones) {
    IntMap map = new IntMap(original.size);

    for (Object object : original.entries()) {
        Entry entry = (Entry) object;//ww  w  .j av a2 s .  c  om
        map.put(entry.key, cloner.deepClone(entry.value, clones));
    }

    return map;
}

From source file:com.kotcrab.vis.editor.serializer.json.IntMapJsonSerializer.java

License:Apache License

@Override
public JsonElement serialize(IntMap<T> intMap, Type typeOfSrc, JsonSerializationContext context) {
    JsonArray jsonArray = new JsonArray();
    for (IntMap.Entry<T> entry : intMap.entries()) {
        JsonObject jsonObject = new JsonObject();
        jsonObject.add(String.valueOf(entry.key), context.serialize(entry.value, entry.value.getClass()));
        GsonUtils.appendClassProperty(jsonObject, entry.value, context);

        jsonArray.add(jsonObject);//w ww  .  j  av  a2  s.  c  om
    }

    return jsonArray;
}

From source file:com.kotcrab.vis.runtime.scene.IntMapJsonSerializer.java

License:Apache License

@Override
public void write(Json json, IntMap object, Class knownType) {
    json.writeObjectStart();//from   ww w  .  ja  va 2  s.c o  m

    for (IntMap.Entry entry : (IntMap.Entries<?>) object.entries()) {
        json.writeValue(String.valueOf(entry.key), entry.value, null);
    }

    json.writeObjectEnd();
}