首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > 其他 > aggregatedset是一个集语义,它允许您存储在单一元素和值对数据结构。值会被自动更新(在一个相当“功能性情绪”),整体结构是线程安全的,使用轻便,无锁

aggregatedset是一个集语义,它允许您存储在单一元素和值对数据结构。值会被自动更新(在一个相当“功能性情绪”),整体结构是线程安全的,使用轻便,无锁

资 源 简 介

A line of code speaks a thousand words :-) Suppose you want to store a counter with each unique element in set (so that it resembles multiset a little). Suppose you have multiple threads raging around. Well, if it seemed like problem, now I hope it does not. First, let"s take care of counting: ``` public final class Counter implements Aggregator { @Override public Integer aggregate(Integer value, Integer current) { if (value == null) return current + 1; return current + value; } @Override public Integer initial() { return 1; } } ``` And plug your counter into this set: AggregatedSet set = new AggregatedSet(new Counter());set.add("A"); //treat it like set.add("A"); //now, it"s set.add("A", 2); // Voila! Let"s say we

文 件 列 表

aggregated_set_v1r20.jar
licence.txt
src
mr
doc
index-files
mr
resources
allclasses-frame.html
allclasses-noframe.html
constant-values.html
deprecated-list.html
help-doc.html
index.html
overview-tree.html
package-list
stylesheet.css
lib
junit-4.7.jar
build.xml
VIP VIP
0.176009s