Example usage for java.util Comparator interface-usage

List of usage examples for java.util Comparator interface-usage

Introduction

In this page you can find the example usage for java.util Comparator interface-usage.

Usage

From source file org.optaplanner.examples.driverallot.domain.solver.RouteTripDifficultyComparator.java

public class RouteTripDifficultyComparator implements Comparator<RouteTrip>, Serializable {

    public int compare(RouteTrip a, RouteTrip b) {
        return new CompareToBuilder().append(b.getRank(), a.getRank()).toComparison();
    }

From source file org.sventon.util.RepositoryEntryComparator.java

/**
 * <code>java.util.Comparator&lt;T&gt;</code> implementation to support
 * ordering of <code>RepositoryEntry</code> objects.
 * <p/>
 * The comparator can be configured during construction to tweak sorting behavior.
 *

From source file Main.java

class MyComparator implements Comparator<Student> {

    @Override
    public int compare(Student s1, Student s2) {
        return s1.name.compareTo(s2.name);
    }

From source file org.jimcat.model.comparator.ComparatorChainProxy.java

/**
 * A Proxy that ensures type safety for the comparator chain.
 * 
 * @see org.apache.commons.collections.comparators.ComparatorChain
 * 
 * $Id$

From source file com.employee.scheduler.nurserostering.domain.solver.ShiftAssignmentDifficultyComparator.java

public class ShiftAssignmentDifficultyComparator implements Comparator<ShiftAssignment>, Serializable {

    public int compare(ShiftAssignment a, ShiftAssignment b) {
        Shift aShift = a.getShift();
        Shift bShift = b.getShift();
        return new CompareToBuilder().append(bShift.getShiftDate(), aShift.getShiftDate()) // Descending

From source file com.adobe.acs.commons.workflow.bulk.removal.impl.WorkflowInstanceFolderComparator.java

public class WorkflowInstanceFolderComparator implements Comparator<Resource> {

    private static final int MAX_SEGMENTS = 4; // YYYY-MM-DD_N

    /**
     * Compares resource names that are in the format YYYY-MM-DD_N where _N is an optional positive integer.

From source file org.jdal.util.comparator.PropertyComparator.java

/**
 * Comparator for generic beans by property value.
 * is an alphaNumeric comparator. When two string have numbers
 * and have same prefix, use numeric comparation so test_10 > than test_2 
 * 
 * @author Jose Luis Martin

From source file org.optaplanner.examples.driverallot.domain.solver.DriverStrengthComparator.java

public class DriverStrengthComparator implements Comparator<Driver>, Serializable {

    public int compare(Driver a, Driver b) {
        //if(a !=null && b!= null)
        return new CompareToBuilder().append(b.getRank(), a.getRank()) // Descending
                .toComparison();

From source file org.optaplanner.examples.nurserostering.domain.solver.ShiftAssignmentDifficultyComparator.java

public class ShiftAssignmentDifficultyComparator implements Comparator<ShiftAssignment>, Serializable {

    public int compare(ShiftAssignment a, ShiftAssignment b) {
        Shift aShift = a.getShift();
        Shift bShift = b.getShift();
        return new CompareToBuilder().append(bShift.getShiftDate(), aShift.getShiftDate()) // Descending

From source file org.unitedinternet.cosmo.model.AuditableComparator.java

/**
 * Compares instances of {@link AuditableObject} based on their
 * created or modified dates.
 */
public class AuditableComparator implements Comparator<AuditableObject> {
    @SuppressWarnings("unused")