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


Java CollectionUtils.subtract方法代碼示例

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


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

示例1: process

import org.apache.commons.collections.CollectionUtils; //導入方法依賴的package包/類
@Override
public void process(WatchedEvent event) throws Exception {
    String topicParentPath = zkConf.getZKBasePath() + "/topics";
    LOG.info("get zookeeper notification for path={}", topicParentPath);
    if (event.getType() == Watcher.Event.EventType.NodeChildrenChanged) {
        List<String> newTopics = zkClient.getChildren().forPath(topicParentPath);
        List<String> oldTopics = metadata.getAllTopics();
        Collection<String> addedTopics = CollectionUtils.subtract(newTopics, oldTopics);
        Collection<String> deletedTopics = CollectionUtils.subtract(oldTopics, newTopics);
        for (String topic : addedTopics) {
            String topicPath = topicParentPath + "/" + topic;
            zkClient.getChildren()
                    .usingWatcher(new TopicWatcher(topic))
                    .forPath(topicPath);
            Map<Integer, Integer> queueMap = readTopicInfo(topic);
            metadata.updateTopicMap(topic, queueMap);
        }
        metadata.removeTopics(deletedTopics);
    }
    zkClient.getChildren()
            .usingWatcher(new TopicsWather())
            .forPath(topicParentPath);
}
 
開發者ID:wenweihu86,項目名稱:distmq,代碼行數:24,代碼來源:MetadataManager.java

示例2: getNotSkippedTasks

import org.apache.commons.collections.CollectionUtils; //導入方法依賴的package包/類
private Collection<String> getNotSkippedTasks() {
    List all = getExecutedTasks();
    Set skipped = getSkippedTasks();
    return CollectionUtils.subtract(all, skipped);
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:6,代碼來源:OutputScrapingExecutionResult.java

示例3: getSymmetricDifference

import org.apache.commons.collections.CollectionUtils; //導入方法依賴的package包/類
/**
 * Returns a pair consisting of two collections: set1 - set2, and set2-set1.
 */
public static Pair getSymmetricDifference(Set set1, Set set2) {
    Collection old = CollectionUtils.subtract(set1, set2);
    Collection newP = CollectionUtils.subtract(set2, set1);
    return new Pair(old, newP);
}
 
開發者ID:dev-cuttlefish,項目名稱:cuttlefish,代碼行數:9,代碼來源:UpdatableIterableLayout.java


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