Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
// ========================================================================
// Copyright (c) 2004-2009 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
package org.eclipse.jetty.util;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/* ------------------------------------------------------------ */
/** A multi valued Map.
* This Map specializes HashMap and provides methods
* that operate on multi valued items.
*
* Implemented as a map of LazyList values
* @param The key type of the map.
*
* @see LazyList
*
*/
public class MultiMap implements ConcurrentMap, Serializable
{
private static final long serialVersionUID = -6878723138353851005L;
Map _map;
ConcurrentMap _cmap;
public MultiMap()
{
_map=new HashMap();
}
public MultiMap(Map map)
{
if (map instanceof ConcurrentMap)
_map=_cmap=new ConcurrentHashMap(map);
else
_map=new HashMap(map);
}
public MultiMap(MultiMap map)
{
if (map._cmap!=null)
_map=_cmap=new ConcurrentHashMap(map._cmap);
else
_map=new HashMap(map._map);
}
public MultiMap(int capacity)
{
_map=new HashMap(capacity);
}
public MultiMap(boolean concurrent)
{
if (concurrent)
_map=_cmap=new ConcurrentHashMap();
else
_map=new HashMap();
}
/* ------------------------------------------------------------ */
/** Get multiple values.
* Single valued entries are converted to singleton lists.
* @param name The entry key.
* @return Unmodifieable List of values.
*/
public List