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
17package com.google.common.collect;
18
19import com.google.common.annotations.GwtCompatible;
20
21import javax.annotation.Nullable;
22
23/**
24 * An empty immutable multiset.
25 *
26 * @author Jared Levy
27 * @author Louis Wasserman
28 */
29@GwtCompatible(serializable = true)
30final class EmptyImmutableMultiset extends ImmutableMultiset<Object> {
31  static final EmptyImmutableMultiset INSTANCE = new EmptyImmutableMultiset();
32
33  @Override
34  public int count(@Nullable Object element) {
35    return 0;
36  }
37
38  @Override
39  public ImmutableSet<Object> elementSet() {
40    return ImmutableSet.of();
41  }
42
43  @Override
44  public int size() {
45    return 0;
46  }
47
48  @Override
49  UnmodifiableIterator<Entry<Object>> entryIterator() {
50    return Iterators.emptyIterator();
51  }
52
53  @Override
54  int distinctElements() {
55    return 0;
56  }
57
58  @Override
59  boolean isPartialView() {
60    return false;
61  }
62
63  @Override
64  ImmutableSet<Entry<Object>> createEntrySet() {
65    return ImmutableSet.of();
66  }
67
68  private static final long serialVersionUID = 0;
69}
70