Package java.util

Examples of java.util.TreeMap.comparator()


        populate(orig);
        assertMapsEqual(new HashMap(orig), (Map) _mgr.copyMap(orig));

        TreeMap torig = (TreeMap) _mgr.newMapProxy(TreeMap.class, null, null,
            new CustomComparator());
        assertTrue(torig.comparator() instanceof CustomComparator);
        populate(torig);
        assertSortedMapsEqual(new TreeMap(torig), (SortedMap)
            _mgr.copyMap(torig));
    }
View Full Code Here


    public void testCloneProxyMap() {
        // Map does not support clone()
       
        TreeMap torig = (TreeMap) _mgr.newMapProxy(TreeMap.class, null, null,
            new CustomComparator());
        assertTrue(torig.comparator() instanceof CustomComparator);
        populate(torig);
        assertSortedMapsEquals(new TreeMap(torig), (SortedMap) torig.clone());
    }

    public void testMapMethodsProxied()
View Full Code Here

      }else{
        out.write(TREEMAP);
        LongPacker.packInt(out,l.size());
      }

      writeObject(out, l.comparator());
      for(Object o:l.keySet()){
        writeObject(out, o);
        writeObject(out, l.get(o));
      }
    }else if(clazz ==  HashMap.class){
View Full Code Here

  static public class TreeMapSerializer extends MapSerializer {
    public void write (Kryo kryo, Output output, Map map) {
      TreeMap treeMap = (TreeMap)map;
      boolean references = kryo.setReferences(false);
      kryo.writeClassAndObject(output, treeMap.comparator());
      kryo.setReferences(references);
      super.write(kryo, output, map);
    }

    protected Map create (Kryo kryo, Input input, Class<Map> type) {
View Full Code Here

  /** Serializer for {@link TreeMap} and any subclass.
   * @author Tumi <serverperformance@gmail.com> (enhacements) */
  static public class TreeMapSerializer extends MapSerializer {
    public void write (Kryo kryo, Output output, Map map) {
      TreeMap treeMap = (TreeMap)map;
      kryo.writeClassAndObject(output, treeMap.comparator());
      super.write(kryo, output, map);
    }

    protected Map create (Kryo kryo, Input input, Class<Map> type) {
      return createTreeMap(type, (Comparator)kryo.readClassAndObject(input));
View Full Code Here

  static public class TreeMapSerializer extends MapSerializer {
    public void write (Kryo kryo, Output output, Map map) {
      TreeMap treeMap = (TreeMap)map;
      boolean references = kryo.setReferences(false);
      kryo.writeClassAndObject(output, treeMap.comparator());
      kryo.setReferences(references);
      super.write(kryo, output, map);
    }

    protected Map create (Kryo kryo, Input input, Class<Map> type) {
View Full Code Here

            }

            @Override
            public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
                TreeMap tm = (TreeMap) super.unmarshal(reader,context);
                return new Tree(tm,tm.comparator());
            }

            @Override
            public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
                super.marshal(((Tree)source).core,writer,context);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.