![JAR search and dependency download from the Maven repository](/logo.png)
com.github.TKnudsen.ComplexDataObject.model.comparators.NumberComparator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of complex-data-object Show documentation
Show all versions of complex-data-object Show documentation
A library that models real-world objects in Java, referred to as ComplexDataObjects. Other features: IO and preprocessing of ComplexDataObjects.
The newest version!
package com.github.TKnudsen.ComplexDataObject.model.comparators;
import java.util.Comparator;
/**
*
* Title: NumberComparator
*
*
*
* Description: compares numbers
*
*
*
* Copyright: Copyright (c) 2018
*
*
* @author Juergen Bernard
* @version 1.01
*/
public class NumberComparator implements Comparator {
@Override
public int compare(Number x, Number y) {
if (x == null && y == null)
return 0;
if (x == null)
return 1;
else if (y == null)
return -1;
Double a = x.doubleValue();
Double b = y.doubleValue();
return Double.compare(a, b);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy