Package java.util

Examples of java.util.Comparator


                    result.add(pos);   
                }
            }
        }
       
        Collections.sort(result, new Comparator() {
            public int compare(Object arg0, Object arg1) {
                PagePosition p1 = (PagePosition)arg0;
                PagePosition p2 = (PagePosition)arg1;
                return p1.getPageNo() - p2.getPageNo();
            }
View Full Code Here


    }

    private BeanProperty[] getPkProperties(JavaClass javaClass) {
        JavaMethod[] methods = javaClass.getMethods();
        JavaMethod method;
        SortedSet propSet = new TreeSet(new Comparator() {
                    public int compare(Object o1, Object o2) {
                        BeanProperty p1 = (BeanProperty) o1;
                        BeanProperty p2 = (BeanProperty) o2;
                        return p1.getName().compareTo(p2.getName());
                    }
View Full Code Here

    System.out.println( "comp1 = " + DHTControlImpl.compareDistances2( d1, d2 ));
    System.out.println( "comp2 = " + DHTControlImpl.computeAndCompareDistances2( t1, t2, target ));
   
    final Set      set =
      new TreeSet(
        new Comparator()
        {
          public int
          compare(
            Object  o1,
            Object  o2 )
View Full Code Here

  findBestContacts(
    int    max )
  {
    Set  set =
      new TreeSet(
          new Comparator()
          {
            public int
            compare(
              Object  o1,
              Object  o2 )
View Full Code Here

   
    List b = new ArrayList( bads );
   
    Collections.sort(
      b,
      new Comparator()
      {
        public int
        compare(
          Object o1,
          Object o2 )
View Full Code Here

      subscriptionItems[currentSelection].selected = true;
    }
   
    final int dir = subscriptionsList.getSortDirection() == SWT.DOWN ? 1 : -1;
    final boolean nameSort = subscriptionsList.getColumn(0) == subscriptionsList.getSortColumn();
    Arrays.sort(subscriptionItems,new Comparator() {
      public int compare(Object arg0, Object arg1) {
        SubscriptionItemModel item0 = (SubscriptionItemModel) arg0;
        SubscriptionItemModel item1 = (SubscriptionItemModel) arg1;
        if(nameSort) {
          return dir * item0.name.compareTo(item1.name);
 
View Full Code Here

     *
     * @param parentList .
     * @param childList .
     */
    public static void sortMoveListByRelativeOrder(final List parentList, List childList) {
        Collections.sort(childList, new Comparator() {
            public int compare(Object o, Object o1) {
                int index = parentList.indexOf(o);
                int index1 = parentList.indexOf(o1);
                return (index < index1) ? -1 : (index > index1) ? 1 : 0;
            }
View Full Code Here

  public EnumSet(EnumItem[] items) {
        m_items = items;
        if (items.length > 0) {
           
            // first sort items in ascending name order
            Arrays.sort(items, new Comparator() {
                public int compare(Object a, Object b) {
                    return ((EnumItem)a).m_name.compareTo(((EnumItem)b).m_name);
                }
            });
           
View Full Code Here

      new Object[] { null, "*start", new Integer(0), "*length", null, "*comparator", null, "*data", UNDEFINED };
  public Any m_sort(Context context, int start, Any length_, Any comparator_, Any data)
  {
    int size = getSize();
    int length = (length_ != null) ? length_.toInt() : size;
    Comparator comparator = null;
    if (comparator_ != null) {
      comparator = new AnyUtils.SequenceComparator(context, comparator_, data);
    }
    long l = ArrayUtils.adjust(start, length, size);
    start  = (int)(l & 0xffffffff);
View Full Code Here

  public Any m_search(Context context, Any element, Any comparator_, Any data)
  {
    int size = getSize();
    int start = 0;
    int length = size;
    Comparator comparator = null;
    if (comparator_ != null) {
      comparator = new AnyUtils.SequenceComparator(context, comparator_, data);
    }
    return Any.create(search(element, comparator));
 
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.