public abstract class Default
extends java.lang.Object
Default contains one-off or 'standard, no-frills'
implementations of simple Iterators,
Collections, and Comparators.| Modifier and Type | Class and Description |
|---|---|
static class |
Default.PairList<A,B>
Pairs, implemented as a
List. |
| Modifier and Type | Field and Description |
|---|---|
static java.util.Comparator |
comparator
A
Comparator for objects that implement
Comparable (checked dynamically at run-time). |
static java.util.SortedMap |
EMPTY_MAP
Deprecated.
Use Collections.EMPTY_MAP
|
static MultiMap |
EMPTY_MULTIMAP
An empty multi-map.
|
static java.util.SortedSet |
EMPTY_SET
Deprecated.
Use Collections.EMPTY_SET
|
static java.util.Iterator |
nullIterator
An
Iterator over the empty set. |
| Constructor and Description |
|---|
Default() |
| Modifier and Type | Method and Description |
|---|---|
static <T extends java.lang.Comparable<T>> |
comparator()
A
Comparator for objects that implement
Comparable (checked dynamically at run-time). |
static <E> java.util.List<E> |
EMPTY_LIST()
Deprecated.
Use Collections.emptyList()
|
static <K,V> java.util.SortedMap<K,V> |
EMPTY_MAP()
Deprecated.
Use Collections.emptyMap()
|
static <K,V> MultiMap<K,V> |
EMPTY_MULTIMAP()
An empty multi-map, parameterized to play nicely with Java's
type system.
|
static <E> java.util.SortedSet<E> |
EMPTY_SET()
Deprecated.
Use Collections.emptySet()
|
static <K,V> java.util.Map.Entry<K,V> |
entry(K key,
V value)
|
static <E> java.util.Iterator<E> |
nullIterator()
An
Iterator over the empty set, parameterized to
play nicely with Java's type system. |
static <A,B> Default.PairList<A,B> |
pair(A left,
B right)
A pair constructor method.
|
static <E> java.util.Iterator<E> |
singletonIterator(E o)
An
Iterator over a singleton set. |
static <A> java.util.Collection<A> |
unmodifiableCollection(java.util.Collection<? extends A> cc)
Improved
unmodifiableCollection() class that
helps w/ covariant subtyping. |
static <E> java.util.Iterator<E> |
unmodifiableIterator(java.util.Iterator<E> i)
An unmodifiable version of the given iterator.
|
public static final java.util.Comparator comparator
Comparator for objects that implement
Comparable (checked dynamically at run-time).public static final java.util.Iterator nullIterator
Iterator over the empty set.public static final java.util.SortedSet EMPTY_SET
public static final java.util.SortedMap EMPTY_MAP
Collections in
Java 1.2.public static final MultiMap EMPTY_MULTIMAP
public static final <T extends java.lang.Comparable<T>> java.util.Comparator<T> comparator()
Comparator for objects that implement
Comparable (checked dynamically at run-time).
This version is parameterized to play nicely with Java's
type system.public static final <E> java.util.Iterator<E> nullIterator()
Iterator over the empty set, parameterized to
play nicely with Java's type system.public static final <E> java.util.Iterator<E> singletonIterator(E o)
Iterator over a singleton set.public static final <E> java.util.Iterator<E> unmodifiableIterator(java.util.Iterator<E> i)
public static final <E> java.util.SortedSet<E> EMPTY_SET()
public static final <E> java.util.List<E> EMPTY_LIST()
public static final <K,V> java.util.SortedMap<K,V> EMPTY_MAP()
public static final <K,V> MultiMap<K,V> EMPTY_MULTIMAP()
public static <A> java.util.Collection<A> unmodifiableCollection(java.util.Collection<? extends A> cc)
unmodifiableCollection() class that
helps w/ covariant subtyping.public static <A,B> Default.PairList<A,B> pair(A left, B right)
hashCode()
and equals() "properly" so they can be used as keys
in hashtables and etc. They are implemented as mutable lists of
fixed size 2.public static <K,V> java.util.Map.Entry<K,V> entry(K key,
V value)
Set
views of Maps and MultiMaps.
The returned object is an instance of Map.Entry;
the only (real) difference from the pairs returned by
Default.pair() is the definition of
hashCode(), which corresponds to Map.Entry
(being key.hashCode() ^ value.hashCode() ) rather
than List (which would be
31*(31+key.hashCode())+value.hashCode() ). This is
an annoying distinction; I wish the JDK API authors had made
these consistent. The Map.Entry returned is immutable.Copyright (c) 2006 C. Scott Ananian