本文整理汇总了Java中org.apache.commons.collections.comparators.NullComparator类的典型用法代码示例。如果您正苦于以下问题:Java NullComparator类的具体用法?Java NullComparator怎么用?Java NullComparator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NullComparator类属于org.apache.commons.collections.comparators包,在下文中一共展示了NullComparator类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ReferenceComparator
import org.apache.commons.collections.comparators.NullComparator; //导入依赖的package包/类
public ReferenceComparator() {
Comparator<String> stringComparator = new Comparator<String>() {
@Override
public int compare(String o1, String o2) {
return o1.compareTo(o2);
}
};
nullSafeStringComparator = new NullComparator(stringComparator, false);
}
示例2: getComparator
import org.apache.commons.collections.comparators.NullComparator; //导入依赖的package包/类
public static <T> Comparator<T> getComparator(String columnName, boolean reverse) {
Comparator<T> c;
if (reverse) {
c = Collections.reverseOrder(new BeanComparator<T>(columnName, new NullComparator(false)));
} else {
c = new BeanComparator<T>(columnName, new NullComparator(false));
}
return c;
}
示例3: getFormulasList
import org.apache.commons.collections.comparators.NullComparator; //导入依赖的package包/类
/**
* getFormulasList returns a List of all formulas, sorted by formula name
* @return
*/
public List<CalculatedQuestionFormulaBean> getFormulasList() {
List<CalculatedQuestionFormulaBean> beanList = new ArrayList<CalculatedQuestionFormulaBean>(formulas.values());
Collections.sort(beanList, new Comparator<CalculatedQuestionFormulaBean>() {
public int compare(CalculatedQuestionFormulaBean bean1, CalculatedQuestionFormulaBean bean2) {
return new NullComparator().compare(bean1.getName(), bean2.getName());
}
});
return beanList;
}
示例4: getVariablesList
import org.apache.commons.collections.comparators.NullComparator; //导入依赖的package包/类
/**
* getVariablesList returns a List of all variables, sorted by variable name
* @return
*/
public List<CalculatedQuestionVariableBean> getVariablesList() {
List<CalculatedQuestionVariableBean> beanList = new ArrayList<CalculatedQuestionVariableBean>(variables.values());
Collections.sort(beanList, new Comparator<CalculatedQuestionVariableBean>() {
public int compare(CalculatedQuestionVariableBean bean1, CalculatedQuestionVariableBean bean2) {
return new NullComparator().compare(bean1.getName(), bean2.getName());
}
});
return beanList;
}
示例5: sortSearchResult
import org.apache.commons.collections.comparators.NullComparator; //导入依赖的package包/类
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;
}
示例6: getUnderlyingComparator
import org.apache.commons.collections.comparators.NullComparator; //导入依赖的package包/类
/**
*
* 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();
}
示例7: getUnderlyingComparator
import org.apache.commons.collections.comparators.NullComparator; //导入依赖的package包/类
/**
* 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<T> getUnderlyingComparator(final Object property) {
return new NullComparator();
}