Example usage for java.lang Character compare

List of usage examples for java.lang Character compare

Introduction

In this page you can find the example usage for java.lang Character compare.

Prototype

public static int compare(char x, char y) 

Source Link

Document

Compares two char values numerically.

Usage

From source file:Main.java

public static void main(String[] args) {

    System.out.println(Character.compare('a', 'b'));
}

From source file:net.mintern.primitive.pair.CharPair.java

/**
 * Compares the pair based on the left element followed by the right element.
 *
 * @param other  the other pair, not null
 * @return negative if this is less, zero if equal, positive if greater
 *//*w  w w  .ja v  a2  s .  co  m*/
@Override
public int compareTo(CharPair other) {
    int cmp = Character.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Character.compare(getRight(), other.getRight());
}

From source file:net.mintern.primitive.pair.CharIntPair.java

/**
 * Compares the pair based on the left element followed by the right element.
 *
 * @param other  the other pair, not null
 * @return negative if this is less, zero if equal, positive if greater
 *//*ww w.  j a  v a2s.  c  om*/
@Override
public int compareTo(CharIntPair other) {
    int cmp = Character.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Integer.compare(getRight(), other.getRight());
}

From source file:net.mintern.primitive.pair.CharBytePair.java

/**
 * Compares the pair based on the left element followed by the right element.
 *
 * @param other  the other pair, not null
 * @return negative if this is less, zero if equal, positive if greater
 *///ww  w . ja v  a 2 s.  com
@Override
public int compareTo(CharBytePair other) {
    int cmp = Character.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Byte.compare(getRight(), other.getRight());
}

From source file:net.mintern.primitive.pair.CharLongPair.java

/**
 * Compares the pair based on the left element followed by the right element.
 *
 * @param other  the other pair, not null
 * @return negative if this is less, zero if equal, positive if greater
 *//*from   ww  w.  ja  v a  2s .c om*/
@Override
public int compareTo(CharLongPair other) {
    int cmp = Character.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Long.compare(getRight(), other.getRight());
}

From source file:net.mintern.primitive.pair.CharBooleanPair.java

/**
 * Compares the pair based on the left element followed by the right element.
 *
 * @param other  the other pair, not null
 * @return negative if this is less, zero if equal, positive if greater
 *///from www . j  a  va  2s  .  c om
@Override
public int compareTo(CharBooleanPair other) {
    int cmp = Character.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Boolean.compare(getRight(), other.getRight());
}

From source file:net.mintern.primitive.pair.IntCharPair.java

/**
 * Compares the pair based on the left element followed by the right element.
 *
 * @param other  the other pair, not null
 * @return negative if this is less, zero if equal, positive if greater
 *//*from w  w w .  j av  a 2 s  .  c o  m*/
@Override
public int compareTo(IntCharPair other) {
    int cmp = Integer.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Character.compare(getRight(), other.getRight());
}

From source file:net.mintern.primitive.pair.LongCharPair.java

/**
 * Compares the pair based on the left element followed by the right element.
 *
 * @param other  the other pair, not null
 * @return negative if this is less, zero if equal, positive if greater
 */// w  w w  .  j a va2s.  com
@Override
public int compareTo(LongCharPair other) {
    int cmp = Long.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Character.compare(getRight(), other.getRight());
}

From source file:net.mintern.primitive.pair.FloatCharPair.java

/**
 * Compares the pair based on the left element followed by the right element.
 *
 * @param other  the other pair, not null
 * @return negative if this is less, zero if equal, positive if greater
 *//*www  . ja v  a  2  s.  co m*/
@Override
public int compareTo(FloatCharPair other) {
    int cmp = Float.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Character.compare(getRight(), other.getRight());
}

From source file:net.mintern.primitive.pair.DoubleCharPair.java

/**
 * Compares the pair based on the left element followed by the right element.
 *
 * @param other  the other pair, not null
 * @return negative if this is less, zero if equal, positive if greater
 *///ww  w.  jav  a2s .  c  o  m
@Override
public int compareTo(DoubleCharPair other) {
    int cmp = Double.compare(getLeft(), other.getLeft());
    return cmp != 0 ? cmp : Character.compare(getRight(), other.getRight());
}