/* * Copyright 2013 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ratpack.func; import com.google.common.collect.ListMultimap; import java.util.List; import java.util.Map; /** * A map that may contain multiple values for a given key, but typically only one value. *
* Unlike other multi map types, this type is optimized for the case where there is only one value for a key. * The map acts just like a normal {@link Map}, but has extra methods for getting all values for a key. *
* All implementations of this type are immutable. Mutating operations throw {@link UnsupportedOperationException}. *
* Where there is multiple values for a given key, retrieving a single value will return the first value,
* where the first value is intrinsic to the service in which the map is being used.
*
* @param
* The returned list is immutable.
*
* @param key The key to return all values of
* @return all of the values for the given key, or an empty list if there are no values for the key.
*/
List
* The returned map is immutable.
* @return A new view of the map where each map value is a list of all the values for the given key
*/
Map