Package net.algart.arrays
Class JArrays.FloatArrayComparator
java.lang.Object
net.algart.arrays.JArrays.FloatArrayComparator
- All Implemented Interfaces:
ArrayComparator
,ArrayComparator32
- Enclosing class:
JArrays
Simple implementation of
ArrayComparator
, comparing elements of float[] array.
Note that elements of float[] array are compared by Float.compare(float, float) method. So, NaN is considered to be equal to itself and greater than all other float values (including POSITIVE_INFINITY), and 0.0 is considered be greater than -0.0.
-
Constructor Summary
ConstructorDescriptionFloatArrayComparator
(float[] array) Creates new comparator, comparing elements of the passed array. -
Method Summary
Modifier and TypeMethodDescriptionboolean
less
(int first, int second) Returns true if, and only if, the element array[(int)first] is less than the element array[(int)second], where array is the argument of the constructor.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.algart.arrays.ArrayComparator32
less
-
Constructor Details
-
FloatArrayComparator
public FloatArrayComparator(float[] array) Creates new comparator, comparing elements of the passed array.- Parameters:
array
- some Java array.- Throws:
NullPointerException
- if the argument is null.
-
-
Method Details
-
less
public boolean less(int first, int second) Returns true if, and only if, the element array[(int)first] is less than the element array[(int)second], where array is the argument of the constructor.- Specified by:
less
in interfaceArrayComparator32
- Parameters:
first
- index of the first compared element.second
- index of the second compared element.- Returns:
- whether the element #first is less than the element #second.
-