public class TrimBlanksStringComparator extends Object implements Comparator<String>
Modifier and Type | Class and Description |
---|---|
static class |
TrimBlanksStringComparator.Mode
Mode defining which end of the strings should be trimmed for blanks.
|
Constructor and Description |
---|
TrimBlanksStringComparator(TrimBlanksStringComparator.Mode mode,
Comparator<? super CharSequence> comparator)
Constructor with mode and delegate comparator performing the actual
string comparison on the trimmed strings or character sequences.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(String s1,
String s2) |
(package private) static int |
findEndTrimBlanks(CharSequence s)
Finds and returns the end of the given character sequence after trimming
spaces and tabs.
|
(package private) static int |
findStartTrimBlanks(CharSequence s)
Finds and returns the start of the given character sequence after
trimming spaces and tabs.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public TrimBlanksStringComparator(TrimBlanksStringComparator.Mode mode, Comparator<? super CharSequence> comparator)
mode
- the mode defining which end of the character sequence should
be trimmedcomparator
- delegate comparator performing the actual comparison after
trimmingpublic int compare(String s1, String s2)
compare
in interface Comparator<String>
static int findStartTrimBlanks(CharSequence s)
s
- the character sequenceStringUtil.findStartTrimWhitespace(CharSequence)
static int findEndTrimBlanks(CharSequence s)
s
- the character sequenceStringUtil.findEndTrimWhitespace(CharSequence)
Copyright © 2024. All rights reserved.