1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 package org.apache.commons.collections4; 18 19 import java.util.Collection; 20 import java.util.Set; 21 22 /** 23 * The "read" subset of the {@link java.util.Map} interface. 24 * 25 * @param <K> the type of the keys in this map 26 * @param <V> the type of the values in this map 27 * 28 * @since 4.0 29 * @see Put 30 */ 31 public interface Get<K, V> { 32 33 /** 34 * @param key key whose presence in this map is to be tested 35 * @return {@code true} if this map contains a mapping for the specified 36 * key 37 * @see java.util.Map#containsKey(Object) 38 */ 39 boolean containsKey(Object key); 40 41 /** 42 * @param value value whose presence in this map is to be tested 43 * @return {@code true} if this map maps one or more keys to the 44 * specified value 45 * @see java.util.Map#containsValue(Object) 46 */ 47 boolean containsValue(Object value); 48 49 /** 50 * @return a set view of the mappings contained in this map 51 * @see java.util.Map#entrySet() 52 */ 53 Set<java.util.Map.Entry<K, V>> entrySet(); 54 55 /** 56 * @param key the key whose associated value is to be returned 57 * @return the value to which the specified key is mapped, or 58 * {@code null} if this map contains no mapping for the key 59 * @see java.util.Map#get(Object) 60 */ 61 V get(Object key); 62 63 /** 64 * @return {@code true} if this map contains no key-value mappings 65 * @see java.util.Map#isEmpty() 66 */ 67 boolean isEmpty(); 68 69 /** 70 * @return a set view of the keys contained in this map 71 * @see java.util.Map#keySet() 72 */ 73 Set<K> keySet(); 74 75 /** 76 * @param key key whose mapping is to be removed from the map 77 * @return the previous value associated with {@code key}, or 78 * {@code null} if there was no mapping for {@code key}. 79 * @see java.util.Map#remove(Object) 80 */ 81 V remove(Object key); 82 83 /** 84 * @return the number of key-value mappings in this map 85 * @see java.util.Map#size() 86 */ 87 int size(); 88 89 /** 90 * @return a collection view of the values contained in this map 91 * @see java.util.Map#values() 92 */ 93 Collection<V> values(); 94 95 }