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 SortByMark.java

class SortByMark implements Comparator<Student> {
    @Override
    public int compare(Student studentOne, Student studentTwo) {
        return studentOne.getMark().compareTo(studentTwo.getMark());
    }
}

From source file SortByHouseNo.java

class SortByHouseNo implements Comparator<HouseNo> {

    @Override
    public int compare(HouseNo o1, HouseNo o2) {
        Integer first = Integer.valueOf(o1.getHouseno());
        Integer second = Integer.valueOf(o2.getHouseno());

From source file MyComparator.java

class MyComparator implements Comparator<Map.Entry> {
    public int compare(Entry o1, Entry o2) {
        Double valueOne = (Double) o1.getValue();
        Double valueTwo = (Double) o2.getValue();
        return (int) Math.signum(valueOne.compareTo(valueTwo));
    }

From source file cz.tsystems.data.DMPlannedOrder.java

@JsonIgnoreProperties(ignoreUnknown = true)
public class DMPlannedOrder implements Comparator<DMPlannedOrder> {
    public static final int ITEM = 0;
    public static final int SECTION = 1;

    public final int type;

From source file MyComparator.java

class MyComparator implements Comparator<Entry<String, Integer>> {
    public int compare(Entry<String, Integer> o1, Entry<String, Integer> o2) {
        return o1.getValue().compareTo(o2.getValue());
    }
}

From source file EmpComparator.java

public class EmpComparator implements Comparator {
    public int compare(Object obj1, Object obj2) {
        Person emp1 = (Person) obj1;
        Person emp2 = (Person) obj2;

        int nameComp = emp1.getFirstName().compareTo(emp2.getFirstName());

From source file lucel_updater.utils.LastModifiedComparator.java

/**
 *
 * @author NeNiuM
 */
public class LastModifiedComparator implements Comparator<FTPFile> {

From source file common.EmployeeByLastName.java

/**
 *
 * @author NStokesBeamon
 */
public class EmployeeByLastName implements Comparator<Employee> {

From source file common.BikeByManufacturer.java

/**
 *
 * @author trogers8
 */
public class BikeByManufacturer implements Comparator<Bike> {

From source file common.EmployeeByFirstName.java

/**
 *
 * @author Jennifer
 */
public class EmployeeByFirstName implements Comparator<Employee> {