當前位置: 首頁>>代碼示例>>Java>>正文


Java ListMultimap.removeAll方法代碼示例

本文整理匯總了Java中com.google.common.collect.ListMultimap.removeAll方法的典型用法代碼示例。如果您正苦於以下問題:Java ListMultimap.removeAll方法的具體用法?Java ListMultimap.removeAll怎麽用?Java ListMultimap.removeAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.common.collect.ListMultimap的用法示例。


在下文中一共展示了ListMultimap.removeAll方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: remove

import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
DOMRpcRoutingTable remove(final DOMRpcImplementation implementation, final Set<DOMRpcIdentifier> rpcs) {
    if (rpcs.isEmpty()) {
        return this;
    }

    // First decompose the identifiers to a multimap
    final ListMultimap<SchemaPath, YangInstanceIdentifier> toRemove = decomposeIdentifiers(rpcs);

    // Now iterate over existing entries, modifying them as appropriate...
    final Builder<SchemaPath, AbstractDOMRpcRoutingTableEntry> b = ImmutableMap.builder();
    for (Entry<SchemaPath, AbstractDOMRpcRoutingTableEntry> e : this.rpcs.entrySet()) {
        final List<YangInstanceIdentifier> removed = new ArrayList<>(toRemove.removeAll(e.getKey()));
        if (!removed.isEmpty()) {
            final AbstractDOMRpcRoutingTableEntry ne = e.getValue().remove(implementation, removed);
            if (ne != null) {
                b.put(e.getKey(), ne);
            }
        } else {
            b.put(e);
        }
    }

    // All done, whatever is in toRemove, was not there in the first place
    return new DOMRpcRoutingTable(b.build(), schemaContext);
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:26,代碼來源:DOMRpcRoutingTable.java

示例2: add

import com.google.common.collect.ListMultimap; //導入方法依賴的package包/類
DOMRpcRoutingTable add(final DOMRpcImplementation implementation, final Set<DOMRpcIdentifier> rpcs) {
    if (rpcs.isEmpty()) {
        return this;
    }

    // First decompose the identifiers to a multimap
    final ListMultimap<SchemaPath, YangInstanceIdentifier> toAdd = decomposeIdentifiers(rpcs);

    // Now iterate over existing entries, modifying them as appropriate...
    final Builder<SchemaPath, AbstractDOMRpcRoutingTableEntry> mb = ImmutableMap.builder();
    for (Entry<SchemaPath, AbstractDOMRpcRoutingTableEntry> re : this.rpcs.entrySet()) {
        List<YangInstanceIdentifier> newRpcs = new ArrayList<>(toAdd.removeAll(re.getKey()));
        if (!newRpcs.isEmpty()) {
            final AbstractDOMRpcRoutingTableEntry ne = re.getValue().add(implementation, newRpcs);
            mb.put(re.getKey(), ne);
        } else {
            mb.put(re);
        }
    }

    // Finally add whatever is left in the decomposed multimap
    for (Entry<SchemaPath, Collection<YangInstanceIdentifier>> e : toAdd.asMap().entrySet()) {
        final Builder<YangInstanceIdentifier, List<DOMRpcImplementation>> vb = ImmutableMap.builder();
        final List<DOMRpcImplementation> v = Collections.singletonList(implementation);
        for (YangInstanceIdentifier i : e.getValue()) {
            vb.put(i, v);
        }

        mb.put(e.getKey(), createRpcEntry(schemaContext, e.getKey(), vb.build()));
    }

    return new DOMRpcRoutingTable(mb.build(), schemaContext);
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:34,代碼來源:DOMRpcRoutingTable.java


注:本文中的com.google.common.collect.ListMultimap.removeAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。