2 * (C) Copyright 2017 Pantheon Technologies, s.r.o. and others.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.opendaylight.yangtools.triemap;
18 import static com.google.common.base.Preconditions.checkNotNull;
20 import java.util.AbstractSet;
21 import java.util.Map.Entry;
24 * Abstract base class for implementing {@link TrieMap} entry sets.
26 * @author Robert Varga
28 * @param <K> the type of entry keys
29 * @param <V> the type of entry values
31 abstract class AbstractEntrySet<K, V> extends AbstractSet<Entry<K, V>> {
32 private final TrieMap<K, V> map;
34 AbstractEntrySet(final TrieMap<K, V> map) {
35 this.map = checkNotNull(map);
38 final TrieMap<K, V> map() {
43 @SuppressWarnings("checkstyle:parameterName")
44 public final boolean contains(final Object o) {
45 if (!(o instanceof Entry)) {
49 final Entry<?, ?> e = (Entry<?, ?>) o;
50 final Object key = e.getKey();
55 final V v = map.get(key);
56 return v != null && v.equals(e.getValue());
60 public final int size() {