Skip to content

How to use TreeMapSerializer ? #767

@Mr14huashao

Description

@Mr14huashao

Kryo doesn't serialize the TreeMapSerializer comparator.
How to reproduce:

        HashMap map = new HashMap();
	map.put(1,122);
	map.put(2,314);
	map.put(4,2511);
	map.put(8,"hello");
	map.put(10,"wasted");
	map.put(3,"Great");
	TreeMap treeMap = new TreeMap(Comparator.reverseOrder());
	treeMap.putAll(map);
           
        final Kryo kryo = new Kryo();
	kryo.register(TreeMap.class, new DefaultSerializers.TreeMapSerializer());
	kryo.writeClassAndObject(output, treeMap);
	Object o = kryo.readClassAndObject(new Input(output.getBuffer()));

Did I use it wrong?
Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions