Package com.tangosol.util.comparator
Class InverseComparator<T>
java.lang.Object
com.tangosol.util.Base
com.tangosol.util.comparator.SafeComparator<T>
com.tangosol.util.comparator.InverseComparator<T>
- All Implemented Interfaces:
ExternalizableLite,PortableObject,EntryAwareComparator<T>,QueryMapComparator<T>,Remote.Comparator<T>,Serializable,Comparator<T>
Comparator that reverses the result of another comparator.
- Author:
- cp/gg 2002.11.01
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter -
Field Summary
Fields inherited from class com.tangosol.util.comparator.SafeComparator
INSTANCE, m_comparator, m_fNullFirst -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor (for ExternalizableLite and PortableObject).InverseComparator(Comparator<? super T> comparator) Construct an InverseComparator. -
Method Summary
Modifier and TypeMethodDescriptionintUse the wrapped Comparator to compare the two arguments for order and negate the result.intcompareEntries(QueryMap.Entry entry1, QueryMap.Entry entry2) Compare two entries using the underlying comparator and negate the result.booleanCompare the InverseComparator with another object to determine equality.Methods inherited from class com.tangosol.util.comparator.SafeComparator
compareSafe, compareSafe, ensureSafe, getComparator, hashCode, INSTANCE, isKeyComparator, isKeyComparator, isNullFirst, readExternal, readExternal, toString, writeExternal, writeExternalMethods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, newHashMap, newHashMap, newHashSet, newHashSet, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, waitMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Comparator
thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongMethods inherited from interface com.tangosol.util.function.Remote.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Constructor Details
-
InverseComparator
public InverseComparator()Default constructor (for ExternalizableLite and PortableObject). -
InverseComparator
Construct an InverseComparator.- Parameters:
comparator- the comparator whose results are inverted by this Comparator
-
-
Method Details
-
compare
Use the wrapped Comparator to compare the two arguments for order and negate the result.- Specified by:
comparein interfaceComparator<T>- Overrides:
comparein classSafeComparator<T>- Parameters:
o1- the first object to be comparedo2- the second object to be compared- Returns:
- a positive integer, zero, or a negative integer as the first argument is less than, equal to, or greater than the second
-
compareEntries
Compare two entries using the underlying comparator and negate the result.- Specified by:
compareEntriesin interfaceQueryMapComparator<T>- Overrides:
compareEntriesin classSafeComparator<T>- Parameters:
entry1- the first entry to compare values from; read-onlyentry2- the second entry to compare values from; read-only- Returns:
- a negative integer, zero, or a positive integer as the first entry denotes a value that is is less than, equal to, or greater than the value denoted by the second entry
-
equals
Compare the InverseComparator with another object to determine equality.- Specified by:
equalsin interfaceComparator<T>- Overrides:
equalsin classSafeComparator<T>- Parameters:
o- the other comparator- Returns:
- true iff this InverseComparator and the passed object are equivalent InverseComparator
-