Package java.util

Examples of java.util.Comparator


        if (allAppenders != null) {
            //
            // this list has to guarantee the order in which elements are added
            //
            List uniqueList = new LinkedList();
            Comparator cmp = new LogDestinationComparator(all);

            Collections.sort(allAppenders, cmp);
            for (int i = 0; i < allAppenders.size(); i++) {
                LogDestination dest = (LogDestination) allAppenders.get(i);
                if (Collections.binarySearch(uniqueList, dest, cmp) < 0) {
View Full Code Here


    public List getLogSources() {
        List sources = new LinkedList();

        List allAppenders = getAllLogDestinations();
        if (allAppenders != null) {
            Comparator cmp = new LogSourceComparator();

            Collections.sort(allAppenders, cmp);
            for (int i = 0; i < allAppenders.size(); i++) {
                LogDestination dest = (LogDestination) allAppenders.get(i);
                if (Collections.binarySearch(sources, dest, cmp) < 0) {
View Full Code Here

            seriesList.add(ser);
        }

        if (useTop) {
            // sorting stats by the avg value to identify the top series
            Collections.sort(seriesList, new Comparator() {
                public int compare(Object o1, Object o2) {
                    Series s1 = (Series) o1;
                    Series s2 = (Series) o2;
                    return s1.avg == s2.avg ? s1.key.compareTo(s2.key) : (s1.avg > s2.avg ? -1 : 1);
                }
            });

            // keeping only the top series in the list
            for (ListIterator i = seriesList.listIterator(getTop()); i.hasNext();) {
                i.next();
                i.remove();
            }
        }

        // sorting the remaining series by name
        Collections.sort(seriesList, new Comparator() {
            public int compare(Object o1, Object o2) {
                return (((Series)o1).key).compareTo(((Series)o2).key);
            }
        });
View Full Code Here

    try {
      plugins = core.getPluginManager().getPluginInterfaces();
     
      Arrays.sort(
          plugins,
        new Comparator()
      {
            public int
        compare(
          Object o1,
          Object o2)
            {
              return(((PluginInterface)o1).getPluginName().compareTo(((PluginInterface)o2).getPluginName()));
            }
      });
    } catch(final Exception e) {
     
      Debug.printStackTrace(e);
    }
    
      // one "plugin" can have multiple interfaces. We need to group by their id
   
    Map  pid_map = new HashMap();
   
    for(int i = 0 ; i < plugins.length ; i++){
     
        PluginInterface plugin = plugins[i];
               
        String  pid   = plugin.getPluginID();
       
        ArrayList  pis = (ArrayList)pid_map.get( pid );
       
        if ( pis == null ){
         
          pis = new ArrayList();
         
          pid_map.put( pid, pis );
        }
       
        pis.add( plugin );
    }
   
    ArrayList[]  pid_list = new ArrayList[pid_map.size()];
   
    pid_map.values().toArray( pid_list );
 
    Arrays.sort(
        pid_list,
        new Comparator()
      {
            public int
        compare(
          Object o1,
          Object o2)
View Full Code Here

      if ( l.size() >= entries_per_alloc ){
     
        synchronized( l ){
         
          Collections.sort( l,
            new Comparator()
            {
              public int
              compare(
                Object  o1,
                Object  o2 )
View Full Code Here

     
      if ( smallest_first ){
       
        Collections.sort(
            instances,
            new Comparator()
            {
              public int
              compare(
                Object  o1,
                Object  o2 )
View Full Code Here

  public Comparator
  getAlphanumericComparator(
    final boolean  ignore_case )
  {
    return(
      new Comparator()
      {
        public int
        compare(
          Object  o1,
          Object  o2 )
View Full Code Here

    }
  }

  protected Comparator getComparator(int column) {
    Class columnType = tableModel.getColumnClass(column);
    Comparator comparator = columnComparators.get(columnType);
    if (comparator != null) {
      return comparator;
    }
    if (Comparable.class.isAssignableFrom(columnType)) {
      return COMPARABLE_COMPARATOR;
View Full Code Here

        // as aggregated totals would not make any sense otherwise
        filterValidDataSources(privateResources, dataSources);
        filterValidDataSources(globalResources, dataSources);

        // sort datasources by JDBC URL
        Collections.sort(dataSources, new Comparator() {
            public int compare(Object o1, Object o2) {
                String jdbcURL1 = ((DataSourceInfo) o1).getJdbcURL();
                String jdbcURL2 = ((DataSourceInfo) o2).getJdbcURL();

                // here we rely on the the filter not to add any
View Full Code Here

  public DisplayList Sort(DisplayList targetList, DisplayList sourceList)
  {
    char sortType = targetList.getSortType();
    TreeMap intermediate = null;
    if (sortType == 'D') {
      Comparator reverse = Collections.reverseOrder();
      intermediate = new TreeMap(reverse);
    } else {
      intermediate = new TreeMap();
    }
    String sortMember = (String)targetList.getSortMember();
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.