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

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

Introduction

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

Prototype

Set<Map.Entry<K, Collection<V>>> entrySet();

Source Link

Document

Returns a set view of the mappings contained in this map.

Usage

From source file:de.dhke.projects.cutil.collections.iterator.MultiMapPairIterable.java

public static <K, V> MultiMapPairIterable<K, V> decorate(final MultiMap<K, V> baseMap) {
    return new MultiMapPairIterable<>(baseMap.entrySet());
}

From source file:de.dhke.projects.cutil.collections.iterator.MultiMapEntryIterable.java

public static <K, V> MultiMapEntryIterable<K, V> decorate(final MultiMap<K, V> baseMap) {
    return new MultiMapEntryIterable<>(baseMap.entrySet());
}

From source file:de.dhke.projects.cutil.collections.iterator.MultiMapEntryIterator.java

public static <K, V> MultiMapEntryIterator<K, V> decorate(final MultiMap<K, V> baseMap) {
    return new MultiMapEntryIterator<>(baseMap.entrySet());
}

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

public static <K, V> int deepHashCode(MultiMap<K, V> m) {
    int hashCode = 65537;
    for (Map.Entry<K, Collection<V>> entry : m.entrySet()) {
        hashCode += 7 * deepHashCode(entry);
    }//w  ww.j  a  v  a 2  s. com
    return hashCode;
}

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 {//from   w  w w  .ja  va 2 s .co m
            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:de.dhke.projects.cutil.collections.iterator.MultiMapEntryIterable.java

protected MultiMapEntryIterable(final MultiMap<K, V> baseMap) {
    _baseIterable = baseMap.entrySet();
}

From source file:de.dhke.projects.cutil.collections.iterator.MultiMapEntryIterator.java

protected MultiMapEntryIterator(final MultiMap<K, V> baseMap) {
    this(baseMap.entrySet());
}

From source file:de.dhke.projects.cutil.collections.aspect.AspectMultiMap.java

@Override
public void putAll(final MultiMap<? extends K, ? extends V> t) {
    for (Iterator<?> it = t.entrySet().iterator(); it.hasNext();) {
        @SuppressWarnings("unchecked")
        final Map.Entry<? extends K, Collection<? extends V>> entry = (Map.Entry<? extends K, Collection<? extends V>>) it
                .next();/*  w w w .  j  a  v  a  2s  .  co m*/
        /**
         * We have to add the collection entries individually in order to obtain
         **/
        for (V value : entry.getValue())
            prepareAdd(entry.getKey(), value);
    }

    for (Iterator<?> it = t.entrySet().iterator(); it.hasNext();) {
        @SuppressWarnings("unchecked")
        Map.Entry<? extends K, Collection<? extends V>> entry = (Map.Entry<? extends K, Collection<? extends V>>) it
                .next();
        for (V value : entry.getValue()) {
            if (!containsValue(entry.getKey(), value)) {
                _baseMap.put(entry.getKey(), value);
                final Map.Entry<K, V> evEntry = new DefaultMapEntry<>(entry.getKey(), value);
                notifyAfterElementAdded(this, evEntry);
            }
        }
    }

}

From source file:de.uniba.wiai.kinf.pw.projects.lillytab.reasoner.abox.LinkMap.java

private Collection<Pair<R, IABoxNode<I, L, K, R>>> getAllEntries(final IABox<I, L, K, R> abox,
        final MultiMap<R, NodeID> map) {
    final List<Pair<R, IABoxNode<I, L, K, R>>> list = new ArrayList<>(map.size());
    for (Map.Entry<R, NodeID> mapEntry : MultiMapEntryIterable.decorate(map.entrySet())) {
        list.add(Pair.wrap(mapEntry.getKey(), abox.getNode(mapEntry.getValue())));
    }/*from  w  ww. j  a v  a2 s.co m*/
    return list;
}

From source file:org.dataconservancy.dcs.index.rebuild.OrderedDcpEntitySource.java

private DcsManifestation createManifestation(DcsDeliverableUnit du, MultiMap<DcsFile, DcsEntity> metadataFiles,
        DcsFile... otherFiles) {//from   w ww  .j av a2s .co  m
    DcsManifestation manifestation = new DcsManifestation();
    manifestation.setId("manifestation_for_" + du.getId() + "." + UUID.randomUUID());
    manifestation.setDeliverableUnit(du.getId());
    manifestation.setDateCreated(DateUtility.toIso8601(new Date()));
    manifestation.addTechnicalEnvironment("env1");
    manifestation.addTechnicalEnvironment("env2");

    for (DcsFile file : otherFiles) {
        DcsManifestationFile mf = new DcsManifestationFile();
        mf.setPath("content/");
        mf.setRef(new DcsFileRef(file.getId()));
        manifestation.addManifestationFile(mf);
    }

    for (Map.Entry<DcsFile, Collection<DcsEntity>> metadataMapping : metadataFiles.entrySet()) {
        DcsManifestationFile mf = new DcsManifestationFile();
        mf.setPath("metadata/");
        mf.setRef(new DcsFileRef(metadataMapping.getKey().getId()));

        for (DcsEntity entity : metadataMapping.getValue()) {
            mf.addRel(new DcsRelation(IS_METADATA_FOR, entity.getId()));
            metadataFilesMap.put(entity.getId(), metadataMapping.getKey());
        }

        manifestation.addManifestationFile(mf);
    }

    entities.put(manifestation.getId(), manifestation);
    return manifestation;
}