Example usage for org.apache.commons.collections MultiHashMap getCollection

List of usage examples for org.apache.commons.collections MultiHashMap getCollection

Introduction

In this page you can find the example usage for org.apache.commons.collections MultiHashMap getCollection.

Prototype

public Collection getCollection(Object key) 

Source Link

Document

Gets the collection mapped to the specified key.

Usage

From source file:it.geosolutions.geobatch.catalog.impl.BaseCatalog.java

/**
 *
 *///ww  w .  j  a  va2 s. co m
@SuppressWarnings("unchecked")
<R extends Resource> List<R> lookup(final Class<R> clazz, final MultiHashMap map) {
    final List<R> result = new ArrayList<R>();

    for (final Class<R> key : (Iterable<Class<R>>) map.keySet()) {
        // for (final Iterator<Class<T>> k = map.keySet().iterator();
        // k.hasNext();) {
        // final Class<T> key = k.next();
        if (clazz.isAssignableFrom(key)) {
            result.addAll(map.getCollection(key));
        }
    }

    return result;
}

From source file:org.geoserver.catalog.impl.CatalogImpl.java

List lookup(Class clazz, MultiHashMap map) {
    ArrayList result = new ArrayList();
    for (Iterator k = map.keySet().iterator(); k.hasNext();) {
        Class key = (Class) k.next();
        if (clazz.isAssignableFrom(key)) {
            result.addAll(map.getCollection(key));
        }/*from w  ww .j ava  2  s. c  om*/
    }

    return result;
}

From source file:org.geoserver.catalog.impl.DefaultCatalogFacade.java

<T> List<T> lookup(Class<T> clazz, MultiHashMap map) {
    ArrayList<T> result = new ArrayList<T>();
    for (Iterator k = map.keySet().iterator(); k.hasNext();) {
        Class key = (Class) k.next();
        if (clazz.isAssignableFrom(key)) {
            Collection value = map.getCollection(key);
            // the map could have been modified in the meantime and the collection removed,
            // check before adding 
            if (value != null) {
                result.addAll(value);//from  ww  w  .j  a v  a 2 s  .co  m
            }
        }
    }

    return result;
}