org.apache.commons.collections.comparators.NullComparator Java Examples
The following examples show how to use
org.apache.commons.collections.comparators.NullComparator.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WorkflowInstancesListController.java From telekom-workflow-engine with MIT License | 5 votes |
protected List<WorkflowInstanceSearchModel> sortSearchResult( List<WorkflowInstanceSearchModel> result, int column, String direction ){ List<WorkflowInstanceSearchModel> unorderedSource = new ArrayList<>( result ); String fieldName = DataTableColumnMapper.from( column ).getFieldName(); BeanComparator<WorkflowInstanceSearchModel> beanComparator; if( "asc".equalsIgnoreCase( direction ) ){ beanComparator = new BeanComparator<>( fieldName, new NullComparator() ); } else{ beanComparator = new BeanComparator<>( fieldName, new ReverseComparator( new NullComparator() ) ); } Collections.sort( unorderedSource, beanComparator ); return unorderedSource; }
Example #2
Source File: ComparatorUtils.java From Penetration_Testing_POC with Apache License 2.0 | 3 votes |
/** * Gets a Comparator that controls the comparison of <code>null</code> values. * <p> * The returned comparator will consider a null value to be less than * any nonnull value, and equal to any other null value. Two nonnull * values will be evaluated with the given comparator. * * @param comparator the comparator that wants to allow nulls * @return a version of that comparator that allows nulls * @see NullComparator */ public static Comparator nullLowComparator(Comparator comparator) { if (comparator == null) { comparator = NATURAL_COMPARATOR; } return new NullComparator(comparator, false); }
Example #3
Source File: ComparatorUtils.java From Penetration_Testing_POC with Apache License 2.0 | 3 votes |
/** * Gets a Comparator that controls the comparison of <code>null</code> values. * <p> * The returned comparator will consider a null value to be greater than * any nonnull value, and equal to any other null value. Two nonnull * values will be evaluated with the given comparator. * * @param comparator the comparator that wants to allow nulls * @return a version of that comparator that allows nulls * @see NullComparator */ public static Comparator nullHighComparator(Comparator comparator) { if (comparator == null) { comparator = NATURAL_COMPARATOR; } return new NullComparator(comparator, true); }
Example #4
Source File: ListContainer.java From viritin with Apache License 2.0 | 2 votes |
/** * * Override point. Allows user to use custom comparators based on * properties. * * @param property the property whose comparator is requested * @return Comparator that will compare two objects based on a property */ protected Comparator<?> getUnderlyingComparator(Object property) { return new NullComparator(); }