Example usage for org.apache.commons.collections15.comparators ComparatorChain addComparator

List of usage examples for org.apache.commons.collections15.comparators ComparatorChain addComparator

Introduction

In this page you can find the example usage for org.apache.commons.collections15.comparators ComparatorChain addComparator.

Prototype

public void addComparator(Comparator<T> comparator) 

Source Link

Document

Add a Comparator to the end of the chain using the forward sort order

Usage

From source file:com.feedzai.fos.server.remote.impl.RemoteInterfacesTest.java

private Comparator<Method> buildComparator() {
    ComparatorChain<Method> chain = new ComparatorChain<Method>();
    chain.addComparator(new Comparator<Method>() {
        @Override//from www. j ava  2  s  . co  m
        public int compare(Method o1, Method o2) {
            return o1.getName().compareTo(o2.getName());
        }
    });
    chain.addComparator(new Comparator<Method>() {
        @Override
        public int compare(Method o1, Method o2) {
            return o1.getParameterTypes().length - o2.getParameterTypes().length;
        }
    });

    return chain;
}