net.cscott.jutil
public abstract class Default extends Object
Version: $Id: Default.java,v 1.8 2006-10-30 19:58:05 cananian Exp $
Nested Class Summary | |
---|---|
static class | Default.PairList<A,B> Pairs, implemented as a List.
|
Field Summary | |
---|---|
static Comparator | comparator A Comparator for objects that implement
Comparable (checked dynamically at run-time). |
static SortedMap | EMPTY_MAP An empty map. |
static MultiMap | EMPTY_MULTIMAP An empty multi-map. |
static SortedSet | EMPTY_SET An empty set. |
static Iterator | nullIterator An Iterator over the empty set. |
Method Summary | |
---|---|
static <T extends Comparable<T>> Comparator<T> | comparator() A Comparator for objects that implement
Comparable (checked dynamically at run-time).
|
static <K,V> Entry<K,V> | entry(K key, V value) A pair constructor method more appropriate for Set
views of Maps and MultiMaps.
|
static <E> List<E> | EMPTY_LIST() An empty list. |
static <K,V> SortedMap<K,V> | EMPTY_MAP() An empty map, parameterized to play nicely with Java's type system. |
static <K,V> MultiMap<K,V> | EMPTY_MULTIMAP() An empty multi-map, parameterized to play nicely with Java's
type system. |
static <E> SortedSet<E> | EMPTY_SET() An empty set; the parameterized version.
|
static <E> Iterator<E> | nullIterator() An Iterator over the empty set, parameterized to
play nicely with Java's type system. |
static <A,B> PairList<A,B> | pair(A left, B right) A pair constructor method. |
static <E> Iterator<E> | singletonIterator(E o) An Iterator over a singleton set. |
static <A> Collection<A> | unmodifiableCollection(Collection<? extends A> cc)
Improved unmodifiableCollection() class that
helps w/ covariant subtyping. |
static <E> Iterator<E> | unmodifiableIterator(Iterator<E> i) An unmodifiable version of the given iterator. |
Deprecated: Use Collections.EMPTY_MAP
An empty map. Missing from java.util.Collections in Java 1.2.Deprecated: Use Collections.EMPTY_SET
An empty set.Default.pair()
is the definition of
hashCode()
, which corresponds to java.util.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 java.util.Map.Entry returned is immutable.Deprecated: Use Collections.emptyList()
An empty list. The parameterized version. Made necessary by limitations in GJ's type system.Deprecated: Use Collections.emptyMap()
An empty map, parameterized to play nicely with Java's type system.Deprecated: Use Collections.emptySet()
An empty set; the parameterized version. Plays nicely with Java's type system.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.unmodifiableCollection()
class that
helps w/ covariant subtyping.