diff options
author | Duncan Jones <djones@apache.org> | 2014-10-19 05:52:37 +0000 |
---|---|---|
committer | Duncan Jones <djones@apache.org> | 2014-10-19 05:52:37 +0000 |
commit | ef26a667633275fa656b74b841f9e74a3a6879ab (patch) | |
tree | a8fc0f85ebc081210f665809d635a1443fb6a949 /src/main/java/org/apache/commons/lang3/CharUtils.java | |
parent | 09cee6a4ada4c7bb69fb32be33001290b744e0fa (diff) | |
download | apache-commons-lang-ef26a667633275fa656b74b841f9e74a3a6879ab.tar.gz |
LANG-536 - Add isSorted() to ArrayUtils. Patch supplied by James Sawle. Closes #32 in GitHub.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1632874 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/main/java/org/apache/commons/lang3/CharUtils.java')
-rw-r--r-- | src/main/java/org/apache/commons/lang3/CharUtils.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/main/java/org/apache/commons/lang3/CharUtils.java b/src/main/java/org/apache/commons/lang3/CharUtils.java index f8f284e65..3f19a214e 100644 --- a/src/main/java/org/apache/commons/lang3/CharUtils.java +++ b/src/main/java/org/apache/commons/lang3/CharUtils.java @@ -535,5 +535,18 @@ public class CharUtils { public static boolean isAsciiAlphanumeric(final char ch) { return isAsciiAlpha(ch) || isAsciiNumeric(ch); } - + + /** + * <p>Compares two {@code char} values numerically. This is the same functionality as provided in Java 7.</p> + * + * @param x the first {@code char} to compare + * @param y the second {@code char} to compare + * @return the value {@code 0} if {@code x == y}; + * a value less than {@code 0} if {@code x < y}; and + * a value greater than {@code 0} if {@code x > y} + * @since 3.4 + */ + public static int compare(char x, char y) { + return x-y; + } } |