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.onebusaway.nyc.vehicle_tracking.impl.sort.NycTestInferredLocationRecordVehicleComparator.java

public class NycTestInferredLocationRecordVehicleComparator implements Comparator<NycTestInferredLocationRecord> {

    @Override
    public int compare(NycTestInferredLocationRecord o1, NycTestInferredLocationRecord o2) {
        return new CompareToBuilder().append(o1.getVehicleId(), o2.getVehicleId()).toComparison();
    }

From source file org.optaplanner.examples.vehiclerouting.domain.solver.LatitudeCustomerDifficultyComparator.java

public class LatitudeCustomerDifficultyComparator implements Comparator<Customer>, Serializable {

    public int compare(Customer a, Customer b) {
        return new CompareToBuilder()
                // TODO experiment with (aLatitude - bLatitude) % 10
                .append(a.getLocation().getLatitude(), b.getLocation().getLatitude())

From source file org.optaplanner.examples.vehiclerouting.domain.solver.VrpCustomerDifficultyComparator.java

public class VrpCustomerDifficultyComparator implements Comparator<Customer>, Serializable {

    public int compare(Customer a, Customer b) {
        return new CompareToBuilder()
                // TODO experiment with (aLatitude - bLatitude) % 10
                .append(a.getLocation().getLatitude(), b.getLocation().getLatitude())

From source file org.kie.karaf.itest.planner.domain.solver.CloudProcessDifficultyComparator.java

public class CloudProcessDifficultyComparator implements Comparator<CloudProcess>, Serializable {
    public int compare(CloudProcess a, CloudProcess b) {
        return new CompareToBuilder().append(a.getRequiredMultiplicand(), b.getRequiredMultiplicand())
                .append(a.getId(), b.getId()).toComparison();
    }

From source file org.optaplanner.examples.cloudbalancing.domain.solver.CloudComputerStrengthComparator.java

public class CloudComputerStrengthComparator implements Comparator<CloudComputer>, Serializable {

    public int compare(CloudComputer a, CloudComputer b) {
        return new CompareToBuilder().append(a.getMultiplicand(), b.getMultiplicand())
                .append(b.getCost(), a.getCost()) // Descending (but this is debatable)
                .append(a.getId(), b.getId()).toComparison();

From source file org.dspace.content.ItemComparator.java

/**
 * Compare two Items by their DCValues.
 * 
 * The DCValues to be compared are specified by the element, qualifier and
 * language parameters to the constructor. If the Item has more than one
 * matching DCValue, then the max parameter to the constructor specifies whether

From source file org.kie.karaf.itest.planner.domain.solver.CloudComputerStrengthComparator.java

public class CloudComputerStrengthComparator implements Comparator<CloudComputer>, Serializable {
    public int compare(CloudComputer a, CloudComputer b) {
        return new CompareToBuilder().append(a.getMultiplicand(), b.getMultiplicand())
                .append(b.getCost(), a.getCost()) // Descending (but this is debatable)
                .append(a.getId(), b.getId()).toComparison();
    }

From source file org.onebusaway.nyc.vehicle_tracking.impl.sort.NycTestInferredLocationRecordDestinationSignCodeComparator.java

public class NycTestInferredLocationRecordDestinationSignCodeComparator
        implements Comparator<NycTestInferredLocationRecord> {

    @Override
    public int compare(NycTestInferredLocationRecord o1, NycTestInferredLocationRecord o2) {
        return new CompareToBuilder().append(o1.getDsc(), o2.getDsc()).toComparison();

From source file org.sakaiproject.gradebookng.business.FirstNameComparator.java

/**
 * Comparator class for sorting a list of users by first name. Secondary sort is on last name to maintain consistent order for those with
 * the same first name
 */
public class FirstNameComparator implements Comparator<User> {

From source file org.sakaiproject.gradebookng.business.LastNameComparator.java

/**
 * Comparator class for sorting a list of users by last name. Secondary sort is on first name to maintain consistent order for those with
 * the same last name
 */
public class LastNameComparator implements Comparator<User> {