Package java.util

Examples of java.util.Comparator


   *
   * @return a MessageNode comparator.
   * @see java.util.Comparator
   */
  public static Comparator getMessageNodeComparator() {
    return new Comparator(){
      //puts the sticky threads first
      public int compare(final Object o1, final Object o2) {
        MessageNode m1 = (MessageNode)o1;
        MessageNode m2 = (MessageNode)o2;       
        if(m1.isSticky() && m2.isSticky()) {
View Full Code Here


      attachments.addAll(msgContainer.getItems(exclFilter));
    }
    // add files from TempFolder
    attachments.addAll(getTempFolderFileList());
   
    Collections.sort(attachments, new Comparator(){
      final Collator c = Collator.getInstance(getLocale());
      public int compare(final Object o1, final Object o2) {
        return c.compare(((VFSItem)o1).getName(), ((VFSItem)o2).getName());
      }});   
   
View Full Code Here

   * <p>
   * @param sortingCriteria
   * @return a Comparator for the input sortingCriteria
   */
  protected Comparator getComparator(final SortingCriteria sortingCriteria) {
    return new Comparator(){     
      public int compare(final Object o1, final Object o2) {
        EfficiencyStatement statement1 = (EfficiencyStatement)o1;
        EfficiencyStatement statement2 = (EfficiencyStatement)o2;   
        int comparisonResult = 0;
        if(sortingCriteria.getSortingTerm()==SortingCriteria.ALPHABETICAL_SORTING) {         
View Full Code Here

  /**
   *
   * @see org.olat.core.gui.control.generic.portal.AbstractPortletRunController#getComparator(org.olat.core.gui.control.generic.portal.SortingCriteria)
   */
  protected Comparator getComparator(final SortingCriteria sortingCriteria) {
    return new Comparator(){     
      public int compare(final Object o1, final Object o2) {
        Note note1= (Note)o1;
        Note note2 = (Note)o2;   
        int comparisonResult = 0;
        if(sortingCriteria.getSortingTerm()==SortingCriteria.ALPHABETICAL_SORTING) {         
View Full Code Here

    List<PortletEntry> entries = getAllPortletEntries();
    return this.getPersistentManuallySortedItems(entries);
  }

   protected Comparator getComparator(final SortingCriteria sortingCriteria) {
      return new Comparator(){     
        public int compare(final Object o1, final Object o2) {
          Subscriber subscriber1= (Subscriber)o1;
          Subscriber subscriber2 = (Subscriber)o2;   
          int comparisonResult = 0;
          if(sortingCriteria.getSortingTerm()==SortingCriteria.ALPHABETICAL_SORTING) {         
View Full Code Here

        if (readOnly && event.getClassification() != KalendarEvent.CLASS_PUBLIC) continue;
        events.add(event);
      }
    }
    // sort events
    Collections.sort(events, new Comparator() {
      public int compare(Object arg0, Object arg1) {
        Date begin0 = ((KalendarEvent) arg0).getBegin();
        Date begin1 = ((KalendarEvent) arg1).getBegin();
        return begin0.compareTo(begin1);
      }
View Full Code Here

   */
  private GenericObjectArrayTableDataModel getGroupOrAreaChoiceTableDataModel(BGContext context) {
    List objectArrays = new ArrayList();
    if (GROUPS_MEMBERS.equals(wizardType)) {
      List<BusinessGroup> groups = BGContextManagerImpl.getInstance().getGroupsOfBGContext(context);
      Collections.sort(groups, new Comparator() {
        @Override
        public int compare(Object o1, Object o2) {
          BusinessGroup g1 = (BusinessGroup) o1;
          BusinessGroup g2 = (BusinessGroup) o2;
          return g1.getName().compareTo(g2.getName());
        }
      });
      for (Iterator iter = groups.iterator(); iter.hasNext();) {
        BusinessGroup group = (BusinessGroup) iter.next();
        Object[] groupChoiceRowData = new Object[2];
        groupChoiceRowData[0] = new Boolean(true);
        groupChoiceRowData[1] = new ObjectWrapper(group);
        objectArrays.add(groupChoiceRowData);
      }
    } else if (AREAS_MEMBERS.equals(wizardType)) {
      List<BGArea> areas = BGAreaManagerImpl.getInstance().findBGAreasOfBGContext(context);
      Collections.sort(areas, new Comparator() {
        @Override
        public int compare(Object o1, Object o2) {
          BGArea a1 = (BGArea) o1;
          BGArea a2 = (BGArea) o2;
          return a1.getName().compareTo(a2.getName());
View Full Code Here

   * <p>
   * @param sortingCriteria
   * @return a Comparator for the input sortingCriteria
   */
  protected Comparator getComparator(final SortingCriteria sortingCriteria) {
    return new Comparator(){     
      public int compare(final Object o1, final Object o2) {
        RepositoryEntry repoEntry1= ((RepositoryPortletEntry)o1).getValue();
        RepositoryEntry repoEntry2 = ((RepositoryPortletEntry)o2).getValue();   
        int comparisonResult = 0;
        if(sortingCriteria.getSortingTerm()==SortingCriteria.ALPHABETICAL_SORTING) {         
View Full Code Here

   * <p>
   * @param sortingCriteria
   * @return a Comparator for the input sortingCriteria
   */
  protected Comparator getComparator(final SortingCriteria sortingCriteria) {
    return new Comparator(){     
      public int compare(final Object o1, final Object o2) {
        BusinessGroup group1= (BusinessGroup)o1;
        BusinessGroup group2 = (BusinessGroup)o2;   
        int comparisonResult = 0;
        if(sortingCriteria.getSortingTerm()==SortingCriteria.ALPHABETICAL_SORTING) {         
View Full Code Here

   * Sorts the input list by adding the sticky messages first.
   * @param topNodeList
   * @return the sorted list.
   */ 
  private List getMessagesSorted(List<Message> topNodeList) {
     Comparator messageNodeComparator = ForumHelper.getMessageNodeComparator();
     Collections.sort(topNodeList, messageNodeComparator);
     return topNodeList;
  }
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.