Example usage for org.apache.commons.collections15 MultiMap containsKey

List of usage examples for org.apache.commons.collections15 MultiMap containsKey

Introduction

In this page you can find the example usage for org.apache.commons.collections15 MultiMap containsKey.

Prototype

boolean containsKey(Object key);

Source Link

Document

Returns true if this map contains a mapping for the specified key.

Usage

From source file:de.dhke.projects.cutil.collections.MultiMapUtil.java

public static <K, V> boolean deepEquals(MultiMap<K, V> m1, MultiMap<? extends K, ? extends V> m2) {
    for (Map.Entry<K, Collection<V>> entry1 : m1.entrySet()) {
        if (!m2.containsKey(entry1.getKey()))
            return false;
        else {// w  w  w.j a v  a2s  . c  om
            final Collection<? extends V> values2 = m2.get(entry1.getKey());
            if ((!entry1.getValue().containsAll(values2)) || (!values2.containsAll(entry1.getValue())))
                return false;
        }
    }
    return m1.keySet().containsAll(m2.keySet());
}

From source file:org.openanzo.datasource.services.BaseUpdateService.java

public void importStatements(IOperationContext context, String reader, String readerFormat,
        Collection<Statement> graphTemplate, Writer output, String resultFormat) throws AnzoException {
    long start = 0;
    if (stats.isEnabled()) {
        start = System.currentTimeMillis();
    }//w  ww  .j a v a 2 s . c  o  m
    throwExceptionIfAnonymousUser(context);
    if (getLockProvider() != null)
        getLockProvider().readLock().lock();
    logEntry();
    try {
        MultiMap<URI, Statement> statements = ReadWriteUtils.readStatementSets(reader, readerFormat);
        if (statements.containsKey(null)) {
            throw new AnzoException(ExceptionConstants.DATASOURCE.STATEMENT_NO_GRAPH);
        }
        if (graphTemplate == null) {
            graphTemplate = Collections.<Statement>emptySet();
        }
        IUpdates updateResults = importStatementsInternal(context, statements, graphTemplate);
        for (IUpdateResultListener listener : datasourceUpdateResultListeners) {
            try {
                listener.updateComplete(context, updateResults);
            } catch (AnzoException ae) {
                log.error(LogUtils.DATASOURCE_MARKER, "Error in listener:" + listener.getClass().getName());
            }
        }
        Boolean fireGlobal = (Boolean) context.getAttribute(FIRE_GLOBAL_UDPATE_EVENTS);
        if (fireGlobal == null || fireGlobal.booleanValue()) {
            for (IUpdateResultListener listener : globalUpdateResultListeners) {
                try {
                    listener.updateComplete(context, updateResults);
                } catch (AnzoException ae) {
                    log.error(LogUtils.DATASOURCE_MARKER, "Error in listener:" + listener.getClass().getName());
                }
            }
        }
        CommonSerializationUtils.writeUpdates(false, updateResults, output, resultFormat);
        if (log.isDebugEnabled()) {
            log.debug(LogUtils.TIMING_MARKER, "Base Import,{},{}", (System.currentTimeMillis() - start),
                    statements.values().size());
        }
    } finally {
        if (stats.isEnabled()) {
            stats.use("importStatements", (System.currentTimeMillis() - start));
        }
        if (getLockProvider() != null)
            getLockProvider().readLock().unlock();
        logExit();
    }
}