aboutsummaryrefslogtreecommitdiffstats
path: root/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/TreeMultimap.java
diff options
context:
space:
mode:
Diffstat (limited to 'guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/TreeMultimap.java')
-rw-r--r--guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/TreeMultimap.java42
1 files changed, 22 insertions, 20 deletions
diff --git a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/TreeMultimap.java b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/TreeMultimap.java
index 5023a0c..228dc2d 100644
--- a/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/TreeMultimap.java
+++ b/guava-gwt/src-super/com/google/common/collect/super/com/google/common/collect/TreeMultimap.java
@@ -22,12 +22,11 @@ import com.google.common.annotations.GwtCompatible;
import java.util.Collection;
import java.util.Comparator;
+import java.util.SortedMap;
import java.util.SortedSet;
import java.util.TreeMap;
import java.util.TreeSet;
-import javax.annotation.Nullable;
-
/**
* Implementation of {@code Multimap} whose keys and values are ordered by
* their natural ordering or by supplied comparators. In all cases, this
@@ -61,16 +60,11 @@ import javax.annotation.Nullable;
* update operations, wrap your multimap with a call to {@link
* Multimaps#synchronizedSortedSetMultimap}.
*
- * <p>See the Guava User Guide article on <a href=
- * "http://code.google.com/p/guava-libraries/wiki/NewCollectionTypesExplained#Multimap">
- * {@code Multimap}</a>.
- *
* @author Jared Levy
- * @author Louis Wasserman
* @since 2.0 (imported from Google Collections Library)
*/
@GwtCompatible(serializable = true, emulated = true)
-public class TreeMultimap<K, V> extends AbstractSortedKeySortedSetMultimap<K, V> {
+public class TreeMultimap<K, V> extends AbstractSortedSetMultimap<K, V> {
private transient Comparator<? super K> keyComparator;
private transient Comparator<? super V> valueComparator;
@@ -136,14 +130,6 @@ public class TreeMultimap<K, V> extends AbstractSortedKeySortedSetMultimap<K, V>
return new TreeSet<V>(valueComparator);
}
- @Override
- Collection<V> createCollection(@Nullable K key) {
- if (key == null) {
- keyComparator().compare(key, key);
- }
- return super.createCollection(key);
- }
-
/**
* Returns the comparator that orders the multimap keys.
*/
@@ -156,10 +142,26 @@ public class TreeMultimap<K, V> extends AbstractSortedKeySortedSetMultimap<K, V>
return valueComparator;
}
- /*
- * The following @GwtIncompatible methods override the methods in
- * AbstractSortedKeySortedSetMultimap, so GWT will fall back to the ASKSSM implementations,
- * which return SortedSets and SortedMaps.
+ /**
+ * {@inheritDoc}
+ *
+ * <p>Because a {@code TreeMultimap} has unique sorted keys, this method
+ * returns a {@link SortedSet}, instead of the {@link java.util.Set} specified
+ * in the {@link Multimap} interface.
*/
+ @Override public SortedSet<K> keySet() {
+ return (SortedSet<K>) super.keySet();
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * <p>Because a {@code TreeMultimap} has unique sorted keys, this method
+ * returns a {@link SortedMap}, instead of the {@link java.util.Map} specified
+ * in the {@link Multimap} interface.
+ */
+ @Override public SortedMap<K, Collection<V>> asMap() {
+ return (SortedMap<K, Collection<V>>) super.asMap();
+ }
}