Package java.util

Examples of java.util.TreeSet.comparator()


        populate(orig);
        assertListsEqual(new ArrayList(orig), (List) _mgr.copyCollection(orig));

        TreeSet torig = (TreeSet) _mgr.newCollectionProxy(TreeSet.class, null,
            new CustomComparator());
        assertTrue(torig.comparator() instanceof CustomComparator);
        populate(torig);
        assertSortedSetsEqual(new TreeSet(torig), (SortedSet)
            _mgr.copyCollection(torig));
    }
View Full Code Here


    public void testCloneProxyCollection() {
        // List doesn't support clone()
       
        TreeSet torig = (TreeSet) _mgr.newCollectionProxy(TreeSet.class, null,
            new CustomComparator());
        assertTrue(torig.comparator() instanceof CustomComparator);
        populate(torig);
        assertSortedSetsEquals(new TreeSet(torig), (SortedSet) torig.clone());
    }

    public void testListMethodsProxied()
View Full Code Here

        out.write(l.size());
      }else{
        out.write(TREESET);
        LongPacker.packInt(out,l.size());
      }
      writeObject(out,l.comparator());

      for(Object o:l)
        writeObject(out, o);
    }else if(clazz ==  HashSet.class){
      HashSet l = (HashSet) obj;
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

  /** Serializer for {@link TreeMap} and any subclass.
   * @author Tumi <serverperformance@gmail.com> (enhacements) */
  static public class TreeSetSerializer extends CollectionSerializer {
    public void write (Kryo kryo, Output output, Collection collection) {
      TreeSet treeSet = (TreeSet)collection;
      kryo.writeClassAndObject(output, treeSet.comparator());
      super.write(kryo, output, collection);
    }

    protected TreeSet create (Kryo kryo, Input input, Class<Collection> type) {
      return createTreeSet(type, (Comparator)kryo.readClassAndObject(input));
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.