Example usage for org.apache.commons.collections ComparatorUtils nullHighComparator

List of usage examples for org.apache.commons.collections ComparatorUtils nullHighComparator

Introduction

In this page you can find the example usage for org.apache.commons.collections ComparatorUtils nullHighComparator.

Prototype

public static Comparator nullHighComparator(Comparator comparator) 

Source Link

Document

Gets a Comparator that controls the comparison of null values.

Usage

From source file:com.facultyshowcase.app.cmscomp.professor.list.ProfessorProfileListGenerator.java

public String getIdentity(CmsRequest<ProfessorProfileListCMSBean> request) {

    Date lastModifiedDate = (Date) ComparatorUtils.min(request.getPageElement().getLastModified(),
            _ProfessorProfileDAO.getLastModifiedDate(),
            ComparatorUtils.nullHighComparator(ComparatorUtils.naturalComparator()));

    return Long.toString(lastModifiedDate.getTime());

}

From source file:com.facultyshowcase.app.cmscomp.professor.viewer.ProfessorProfileGenerator.java

@Override
public String getIdentity(CmsRequest<ProfessorProfileCMSBean> request) {

    String slug = getSlug(request);

    if (StringFactory.trimToNull(slug) == null) {
        return super.getIdentity(request);
    }//from w  w  w  .j  a va  2s .  c om

    Date lastModifiedDate = (Date) ComparatorUtils.min(request.getPageElement().getLastModified(),
            _ProfessorProfileDAO.getLastModifiedDate(slug),
            ComparatorUtils.nullHighComparator(ComparatorUtils.naturalComparator()));

    return slug + " " + lastModifiedDate.getTime();

}

From source file:org.eclipse.jubula.client.alm.mylyn.ui.dialogs.InspectALMAttributesDialog.java

/**
 * @return a null safe natural comparator
 */
private Comparator getCommonsComparator() {
    return ComparatorUtils.nullHighComparator(ComparatorUtils.naturalComparator());
}

From source file:org.eclipse.jubula.client.ui.views.TestresultSummaryView.java

/**
 * Creates and returns a comparator for natural comparison that can also 
 * handle <code>null</code> values. 
 * //  w  w w. j  ava  2 s . c  om
 * @return the created comparator.
 */
@SuppressWarnings("rawtypes")
private static Comparator getCommonsComparator() {
    return ComparatorUtils.nullHighComparator(ComparatorUtils.naturalComparator());
}

From source file:org.openvpms.web.workspace.customer.CustomerMailContext.java

/**
 * Sorts contacts by party name./* www. ja  v  a  2 s.co  m*/
 *
 * @param contacts the contacts to sort
 */
@SuppressWarnings("unchecked")
private void sort(List<Contact> contacts) {
    final Comparator<Object> comparator = (Comparator<Object>) ComparatorUtils.nullHighComparator(null);
    // sort the contacts on party name
    Collections.sort(contacts, new Comparator<Contact>() {
        public int compare(Contact o1, Contact o2) {
            return comparator.compare(o1.getParty().getName(), o2.getParty().getName());
        }
    });
}