1090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson/* 21d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * Copyright (C) 2007 The Guava Authors 3090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * 4090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * Licensed under the Apache License, Version 2.0 (the "License"); 5090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * you may not use this file except in compliance with the License. 6090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * You may obtain a copy of the License at 7090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * 8090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * http://www.apache.org/licenses/LICENSE-2.0 9090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * 10090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * Unless required by applicable law or agreed to in writing, software 11090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * distributed under the License is distributed on an "AS IS" BASIS, 12090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * See the License for the specific language governing permissions and 14090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * limitations under the License. 15090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson */ 16090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson 17090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilsonpackage com.google.common.collect; 18090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson 19090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilsonimport com.google.common.annotations.GwtCompatible; 20090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson 21090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilsonimport java.util.Collection; 22090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilsonimport java.util.List; 23090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilsonimport java.util.Map; 24090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson 25090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilsonimport javax.annotation.Nullable; 26090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson 27090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson/** 28090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * A {@code Multimap} that can hold duplicate key-value pairs and that maintains 29090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * the insertion ordering of values for a given key. 30090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * 31090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * <p>The {@link #get}, {@link #removeAll}, and {@link #replaceValues} methods 32090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * each return a {@link List} of values. Though the method signature doesn't say 33090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * so explicitly, the map returned by {@link #asMap} has {@code List} values. 34090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * 35090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * @author Jared Levy 361d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * @since 2.0 (imported from Google Collections Library) 37090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson */ 38090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson@GwtCompatible 39090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilsonpublic interface ListMultimap<K, V> extends Multimap<K, V> { 40090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson /** 41090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * {@inheritDoc} 42090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * 43090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * <p>Because the values for a given key may have duplicates and follow the 44090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * insertion ordering, this method returns a {@link List}, instead of the 45090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * {@link java.util.Collection} specified in the {@link Multimap} interface. 46090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson */ 471d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert @Override 48090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson List<V> get(@Nullable K key); 49090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson 50090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson /** 51090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * {@inheritDoc} 52090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * 53090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * <p>Because the values for a given key may have duplicates and follow the 54090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * insertion ordering, this method returns a {@link List}, instead of the 55090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * {@link java.util.Collection} specified in the {@link Multimap} interface. 56090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson */ 571d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert @Override 58090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson List<V> removeAll(@Nullable Object key); 59090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson 60090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson /** 61090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * {@inheritDoc} 62090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * 63090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * <p>Because the values for a given key may have duplicates and follow the 64090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * insertion ordering, this method returns a {@link List}, instead of the 65090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * {@link java.util.Collection} specified in the {@link Multimap} interface. 66090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson */ 671d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert @Override 68090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson List<V> replaceValues(K key, Iterable<? extends V> values); 69090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson 70090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson /** 71090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * {@inheritDoc} 72090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * 73090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * <p>Though the method signature doesn't say so explicitly, the returned map 74090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * has {@link List} values. 75090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson */ 761d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert @Override 77090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson Map<K, Collection<V>> asMap(); 78090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson 79090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson /** 80090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * Compares the specified object to this multimap for equality. 81090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * 82090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * <p>Two {@code ListMultimap} instances are equal if, for each key, they 83090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * contain the same values in the same order. If the value orderings disagree, 84090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson * the multimaps will not be considered equal. 851d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * 861d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * <p>An empty {@code ListMultimap} is equal to any other empty {@code 871d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert * Multimap}, including an empty {@code SetMultimap}. 88090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson */ 891d580d0f6ee4f21eb309ba7b509d2c6d671c4044Bjorn Bringert @Override 90090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson boolean equals(@Nullable Object obj); 91090f9b4c879985bc747c214f82c62471e60c7742Jesse Wilson} 92