aboutsummaryrefslogtreecommitdiffstats
path: root/guava/src/com/google/common/collect/AbstractSortedMultiset.java
diff options
context:
space:
mode:
Diffstat (limited to 'guava/src/com/google/common/collect/AbstractSortedMultiset.java')
-rw-r--r--guava/src/com/google/common/collect/AbstractSortedMultiset.java38
1 files changed, 19 insertions, 19 deletions
diff --git a/guava/src/com/google/common/collect/AbstractSortedMultiset.java b/guava/src/com/google/common/collect/AbstractSortedMultiset.java
index 7c277f8..b1a1d54 100644
--- a/guava/src/com/google/common/collect/AbstractSortedMultiset.java
+++ b/guava/src/com/google/common/collect/AbstractSortedMultiset.java
@@ -1,11 +1,11 @@
/*
* Copyright (C) 2011 The Guava Authors
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
@@ -20,9 +20,7 @@ import com.google.common.annotations.GwtCompatible;
import java.util.Comparator;
import java.util.Iterator;
-import java.util.NavigableSet;
-
-import javax.annotation.Nullable;
+import java.util.SortedSet;
/**
* This class provides a skeletal implementation of the {@link SortedMultiset} interface.
@@ -33,28 +31,33 @@ import javax.annotation.Nullable;
*
* @author Louis Wasserman
*/
-@GwtCompatible(emulated = true)
+@GwtCompatible
abstract class AbstractSortedMultiset<E> extends AbstractMultiset<E> implements SortedMultiset<E> {
- @GwtTransient final Comparator<? super E> comparator;
+ final Comparator<? super E> comparator;
// needed for serialization
@SuppressWarnings("unchecked")
AbstractSortedMultiset() {
this((Comparator) Ordering.natural());
}
-
+
AbstractSortedMultiset(Comparator<? super E> comparator) {
this.comparator = checkNotNull(comparator);
}
@Override
- public NavigableSet<E> elementSet() {
- return (NavigableSet<E>) super.elementSet();
+ public SortedSet<E> elementSet() {
+ return (SortedSet<E>) super.elementSet();
}
@Override
- NavigableSet<E> createElementSet() {
- return new SortedMultisets.NavigableElementSet<E>(this);
+ SortedSet<E> createElementSet() {
+ return new SortedMultisets.ElementSet<E>() {
+ @Override
+ SortedMultiset<E> multiset() {
+ return AbstractSortedMultiset.this;
+ }
+ };
}
@Override
@@ -99,11 +102,8 @@ abstract class AbstractSortedMultiset<E> extends AbstractMultiset<E> implements
}
@Override
- public SortedMultiset<E> subMultiset(@Nullable E fromElement, BoundType fromBoundType,
- @Nullable E toElement, BoundType toBoundType) {
- // These are checked elsewhere, but NullPointerTester wants them checked eagerly.
- checkNotNull(fromBoundType);
- checkNotNull(toBoundType);
+ public SortedMultiset<E> subMultiset(E fromElement, BoundType fromBoundType, E toElement,
+ BoundType toBoundType) {
return tailMultiset(fromElement, fromBoundType).headMultiset(toElement, toBoundType);
}
@@ -122,7 +122,7 @@ abstract class AbstractSortedMultiset<E> extends AbstractMultiset<E> implements
}
SortedMultiset<E> createDescendingMultiset() {
- return new DescendingMultiset<E>() {
+ return new SortedMultisets.DescendingMultiset<E>() {
@Override
SortedMultiset<E> forwardMultiset() {
return AbstractSortedMultiset.this;