Package java.util

Examples of java.util.Comparator


   *
   * @return
   */
  public static List getLoggersSortedByName() {
    List loggers = getLoggers();
    Collections.sort(loggers, new Comparator() {
      public int compare(Object o1, Object o2) {
        Logger a = (Logger) o1;
        Logger b = (Logger) o2;
        return a.getName().compareTo(b.getName());
      }
View Full Code Here


            Comparator[] usingComparators = new Comparator[ruleParts.length];
            boolean singleton = true;

            for (int i=0; i<ruleParts.length; i++) {
                BeanComparator rp = ruleParts[i];
                Comparator c2 = rp.mCollator;
                if ((collators[i] = c2) != null) {
                    if (c2 != String.CASE_INSENSITIVE_ORDER) {
                        singleton = false;
                    }
                }
View Full Code Here

            int keyNamesLn = keyNames == null ? 0 : keyNames.length;

            // Copy the Seq into a Java List[KVP] (also detects key type at the 1st item):
            int keyType = KEY_TYPE_NOT_YET_DETECTED;
            Comparator keyComparator = null;
            for (int i = 0; i < ln; i++) {
                TemplateModel item = seq.get(i);
               
                Object key = item;
                for (int keyNameI = 0; keyNameI < keyNamesLn; keyNameI++) {
View Full Code Here

     * @param clr ClassLoader resolver
     * @return The Comparator
     */
    public static Comparator getComparator(AbstractMemberMetaData fmd, ClassLoaderResolver clr)
    {
        Comparator comparator = null;
        String comparatorName = null;
        if (fmd.hasMap() && fmd.getMap().hasExtension("comparator-name"))
        {
            comparatorName = fmd.getMap().getValueForExtension("comparator-name");
        }
View Full Code Here

    }
//    if (DEBUG) System.err.println("len=" + entries.length + ", #f>1=" + (100.0f * head / entries.length));
   
    // sort remaining entries descending by frequency.
    Arrays.sort(entries, 0, head,
      new Comparator() {
        public final int compare(Object e1, Object e2) {
          int f1 = ((Entry) e1).getFrequency();
          int f2 = ((Entry) e2).getFrequency();
          return f2 - f1;
        }
View Full Code Here

        Enumeration myEnum = table.getColumnModel().getColumns();
        for (; myEnum.hasMoreElements();)
            result.add(myEnum.nextElement());

        // Sort the columns based on the model index
        Collections.sort(result, new Comparator() {
            public int compare(Object a, Object b) {
                TableColumn c1 = (TableColumn) a;
                TableColumn c2 = (TableColumn) b;
                if (c1.getModelIndex() < c2.getModelIndex())
                    return -1;
View Full Code Here

      if (files.size() <= 2)
        throw new OperationException(
            "Not enough files to create a good FreedbID, skipping");

      // Sort the files in this album
      Collections.sort(files, new Comparator() {
        public int compare(Object a, Object b) {
          File fa = (File) a;
          File fb = (File) b;
          return fa.getName().compareToIgnoreCase(fb.getName());
        }
View Full Code Here

                    //some datastores do not support backingStores
                }
            }

            // Set up our delegate, using a suitable comparator
            Comparator comparator = SCOUtils.getComparator(fmd, ownerSM.getObjectManager().getClassLoaderResolver());
            if (comparator != null)
            {
                this.delegate = new java.util.TreeMap(comparator);
            }
            else
View Full Code Here

    }

    private static void debugCompilePrio(
        final AnonymClassComparator classComparator) {
        final Map map = classComparator.map;
        Comparator prioComp = new Comparator() {

            public int compare(Object e1, Object e2) {
                int result = ((Comparable) map.get(e1)).compareTo(map.get(e2));
                if (result == 0) {
                    return e1.toString().compareTo(e2.toString());
View Full Code Here

                    //some datastores do not support backingStores
                }
            }

            // Set up our delegate, using suitable comparator (JPOX extension to JDO)
            Comparator comparator = null;
            String comparatorName = null;
            if (fmd.getCollection().hasExtension("comparatorName"))
            {
                comparatorName = fmd.getCollection().getValueForExtension("comparatorName");
                Class comparatorCls = null;
View Full Code Here

TOP

Related Classes of java.util.Comparator

Copyright © 2018 www.massapicom. 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.