Package org.jboss.util.collection
Class ConcurrentSkipListMap.ComparableUsingComparator<K>
- java.lang.Object
-
- org.jboss.util.collection.ConcurrentSkipListMap.ComparableUsingComparator<K>
-
- All Implemented Interfaces:
java.lang.Comparable<K>
- Enclosing class:
- ConcurrentSkipListMap<K,V>
static final class ConcurrentSkipListMap.ComparableUsingComparator<K> extends java.lang.Object implements java.lang.Comparable<K>
Represents a key with a comparator as a Comparable. Because most sorted collections seem to use natural order on Comparables (Strings, Integers, etc), most internal methods are geared to use them. This is generally faster than checking per-comparison whether to use comparator or comparable because it doesn't require a (Comparable) cast for each comparison. (Optimizers can only sometimes remove such redundant checks themselves.) When Comparators are used, ComparableUsingComparators are created so that they act in the same way as natural orderings. This penalizes use of Comparators vs Comparables, which seems like the right tradeoff.
-
-
Constructor Summary
Constructors Constructor Description ComparableUsingComparator(K key, java.util.Comparator<? super K> cmp)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(K k2)
-