1 /* 2 * Copyright (C) 2008 The Guava Authors 3 * 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 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, 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. 15 */ 16 17 package com.google.common.collect; 18 19 import com.google.common.annotations.GwtCompatible; 20 import java.io.Serializable; 21 import org.checkerframework.checker.nullness.qual.Nullable; 22 23 /** 24 * An immutable {@code Map.Entry}, used both by {@link 25 * com.google.common.collect.Maps#immutableEntry(Object, Object)} and by other parts of {@code 26 * common.collect} as a superclass. 27 */ 28 @GwtCompatible(serializable = true) 29 @ElementTypesAreNonnullByDefault 30 class ImmutableEntry<K extends @Nullable Object, V extends @Nullable Object> 31 extends AbstractMapEntry<K, V> implements Serializable { 32 @ParametricNullness final K key; 33 @ParametricNullness final V value; 34 ImmutableEntry(@arametricNullness K key, @ParametricNullness V value)35 ImmutableEntry(@ParametricNullness K key, @ParametricNullness V value) { 36 this.key = key; 37 this.value = value; 38 } 39 40 @Override 41 @ParametricNullness getKey()42 public final K getKey() { 43 return key; 44 } 45 46 @Override 47 @ParametricNullness getValue()48 public final V getValue() { 49 return value; 50 } 51 52 @Override 53 @ParametricNullness setValue(@arametricNullness V value)54 public final V setValue(@ParametricNullness V value) { 55 throw new UnsupportedOperationException(); 56 } 57 58 private static final long serialVersionUID = 0; 59 } 60