5 |
|
*/ |
6 |
|
|
7 |
|
package java.util.concurrent; |
8 |
+ |
import java.io.Serializable; |
9 |
|
import java.util.AbstractCollection; |
10 |
|
import java.util.AbstractMap; |
11 |
|
import java.util.AbstractSet; |
84 |
|
* @since 1.6 |
85 |
|
*/ |
86 |
|
public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V> |
87 |
< |
implements ConcurrentNavigableMap<K,V>, |
87 |
< |
Cloneable, |
88 |
< |
java.io.Serializable { |
87 |
> |
implements ConcurrentNavigableMap<K,V>, Cloneable, Serializable { |
88 |
|
/* |
89 |
|
* This class implements a tree-like two-dimensionally linked skip |
90 |
|
* list in which the index levels are represented in separate |
2528 |
|
* @serial include |
2529 |
|
*/ |
2530 |
|
static final class SubMap<K,V> extends AbstractMap<K,V> |
2531 |
< |
implements ConcurrentNavigableMap<K,V>, Cloneable, |
2533 |
< |
java.io.Serializable { |
2531 |
> |
implements ConcurrentNavigableMap<K,V>, Cloneable, Serializable { |
2532 |
|
private static final long serialVersionUID = -7647078645895051609L; |
2533 |
|
|
2534 |
|
/** Underlying map */ |
3414 |
|
} |
3415 |
|
|
3416 |
|
public int characteristics() { |
3417 |
< |
return Spliterator.CONCURRENT | Spliterator.NONNULL; |
3417 |
> |
return Spliterator.CONCURRENT | Spliterator.ORDERED | |
3418 |
> |
Spliterator.NONNULL; |
3419 |
|
} |
3420 |
|
} |
3421 |
|
|
3509 |
|
} |
3510 |
|
|
3511 |
|
public final Comparator<Map.Entry<K,V>> getComparator() { |
3512 |
< |
return comparator == null ? null : |
3513 |
< |
Entry.comparingByKey(comparator); |
3512 |
> |
// Adapt or create a key-based comparator |
3513 |
> |
if (comparator != null) { |
3514 |
> |
return Map.Entry.comparingByKey(comparator); |
3515 |
> |
} |
3516 |
> |
else { |
3517 |
> |
return (Comparator<Map.Entry<K, V>> & Serializable) (e1, e2) -> { |
3518 |
> |
@SuppressWarnings("unchecked") |
3519 |
> |
Comparable<? super K> k1 = (Comparable<? super K>) e1.getKey(); |
3520 |
> |
return k1.compareTo(e2.getKey()); |
3521 |
> |
}; |
3522 |
> |
} |
3523 |
|
} |
3524 |
|
} |
3525 |
|
|