• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008 The Guava Authors
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy of
6  * the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations under
14  * the License.
15  */
16 
17 package com.google.common.collect;
18 
19 import com.google.common.annotations.GwtCompatible;
20 
21 import javax.annotation.Nullable;
22 
23 /**
24  * An empty immutable multiset.
25  *
26  * @author Jared Levy
27  * @author Louis Wasserman
28  */
29 @GwtCompatible(serializable = true)
30 final class EmptyImmutableMultiset extends ImmutableMultiset<Object> {
31   static final EmptyImmutableMultiset INSTANCE = new EmptyImmutableMultiset();
32 
33   @Override
count(@ullable Object element)34   public int count(@Nullable Object element) {
35     return 0;
36   }
37 
38   @Override
elementSet()39   public ImmutableSet<Object> elementSet() {
40     return ImmutableSet.of();
41   }
42 
43   @Override
size()44   public int size() {
45     return 0;
46   }
47 
48   @Override
entryIterator()49   UnmodifiableIterator<Entry<Object>> entryIterator() {
50     return Iterators.emptyIterator();
51   }
52 
53   @Override
distinctElements()54   int distinctElements() {
55     return 0;
56   }
57 
58   @Override
isPartialView()59   boolean isPartialView() {
60     return false;
61   }
62 
63   @Override
createEntrySet()64   ImmutableSet<Entry<Object>> createEntrySet() {
65     return ImmutableSet.of();
66   }
67 
68   private static final long serialVersionUID = 0;
69 }
70