本文整理汇总了Java中com.google.common.collect.ImmutableSet.Builder.addAll方法的典型用法代码示例。如果您正苦于以下问题:Java Builder.addAll方法的具体用法?Java Builder.addAll怎么用?Java Builder.addAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.ImmutableSet.Builder
的用法示例。
在下文中一共展示了Builder.addAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: adaptMIPResult
import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
protected XORAllocation<T> adaptMIPResult(IMIPResult mipResult) {
Map<Bidder<T>, BidderAllocation<T>> trades = new HashMap<>();
for (Bidder<T> bidder : auction.getBidders()) {
double totalValue = 0;
Builder<Good> goodsBuilder = ImmutableSet.<Good>builder();
Builder<XORValue<T>> bundleBids = ImmutableSet.<XORValue<T>>builder();
for (XORValue<T> bundleBid : auction.getBid(bidder).getValues()) {
if (DoubleMath.fuzzyEquals(mipResult.getValue(getBidVariable(bundleBid)), 1, 1e-3)) {
goodsBuilder.addAll(bundleBid.getLicenses());
bundleBids.add(bundleBid);
totalValue += bundleBid.value().doubleValue();
}
}
Set<Good> goods = goodsBuilder.build();
if (!goods.isEmpty()) {
trades.put(bidder, new BidderAllocation<>(totalValue, new Bundle<>(goods), bundleBids.build()));
}
}
return new XORAllocation<>(trades);
}
示例2: getClassesToCheck
import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
private synchronized Collection<Class<?>> getClassesToCheck()
{
if( classesToCheck == null )
{
Builder<Class<?>> builder = ImmutableSet.builder();
builder.addAll(STATIC_CLASSES_TO_CHECK);
List<Extension> extensions = domainParamTracker.getExtensions();
for( Extension extension : extensions )
{
Collection<Parameter> clazzes = extension.getParameters("class");
for( Parameter clazzParam : clazzes )
{
builder.add(domainParamTracker.getClassForName(extension, clazzParam.valueAsString()));
}
}
classesToCheck = builder.build();
}
return classesToCheck;
}
示例3: listNodesByIds
import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
public Iterable<NodeMetadata> listNodesByIds(Iterable<String> ids) {
List<Instance> instances = new ArrayList<Instance>();
for (String id : ids) {
IAcsClient client = api.getAcsClient(api.decodeToRegion(id));
DescribeInstancesRequest req = new DescribeInstancesRequest();
Gson gson = new GsonBuilder().create();
String iids = gson.toJson(new String[] { api.decodeToId(id) });
req.setInstanceIds(iids);
try {
DescribeInstancesResponse resp = client.getAcsResponse(req);
instances.addAll(resp.getInstances());
} catch (Exception e) {
logger.warn(e.getMessage());
}
}
Builder<NodeMetadata> builder = ImmutableSet.builder();
builder.addAll(transform(instances, new InstanceToNodeMetadata(api, nodeStatus)));
return builder.build();
}
示例4: listNodes
import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
public Iterable<NodeMetadata> listNodes() {
Builder<NodeMetadata> builder = ImmutableSet.builder();
Set<String> regions = api.getAvailableRegions();
for (String region : regions) {
try {
IAcsClient client = api.getAcsClient(region);
DescribeInstancesRequest req = new DescribeInstancesRequest();
DescribeInstancesResponse resp = client.getAcsResponse(req);
builder.addAll(transform(resp.getInstances(), new InstanceToNodeMetadata(api, nodeStatus)));
} catch (Exception e) {
logger.warn(e.getMessage());
}
}
return builder.build();
}
示例5: listImages
import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
public Iterable<Image> listImages() {
Builder<Image> builder = ImmutableSet.builder();
Set<String> regions = api.getAvailableRegions();
for (String region : regions) {
try {
IAcsClient client = api.getAcsClient(region);
DescribeImagesRequest req = new DescribeImagesRequest();
DescribeImagesResponse resp = client.getAcsResponse(req);
builder.addAll(transform(resp.getImages(), new ImageToImage(api, region)));
} catch (Exception e) {
logger.warn(e.getMessage());
}
}
return builder.build();
}
示例6: getOptimizerRules
import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
public Set<StoragePluginOptimizerRule> getOptimizerRules(OptimizerRulesContext optimizerRulesContext) {
Builder<StoragePluginOptimizerRule> setBuilder = ImmutableSet.builder();
for(FormatPlugin plugin : this.formatPluginsByName.values()){
Set<StoragePluginOptimizerRule> rules = plugin.getOptimizerRules();
if(rules != null && rules.size() > 0){
setBuilder.addAll(rules);
}
}
return setBuilder.build();
}
示例7: getStoragePluginRuleSet
import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
public RuleSet getStoragePluginRuleSet(OptimizerRulesContext optimizerRulesContext) {
// query registered engines for optimizer rules and build the storage plugin RuleSet
Builder<RelOptRule> setBuilder = ImmutableSet.builder();
for (StoragePlugin plugin : this.plugins.values()) {
Set<? extends RelOptRule> rules = plugin.getOptimizerRules(optimizerRulesContext);
if (rules != null && rules.size() > 0) {
setBuilder.addAll(rules);
}
}
return DrillRuleSets.create(setBuilder.build());
}
示例8: getLogicalOptimizerRules
import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
public Set<StoragePluginOptimizerRule> getLogicalOptimizerRules(OptimizerRulesContext optimizerRulesContext) {
Builder<StoragePluginOptimizerRule> setBuilder = ImmutableSet.builder();
for(FormatPlugin plugin : formatCreator.getConfiguredFormatPlugins()){
Set<StoragePluginOptimizerRule> rules = plugin.getOptimizerRules(optimizerRulesContext);
if(rules != null && rules.size() > 0){
setBuilder.addAll(rules);
}
}
return setBuilder.build();
}
示例9: listLoadBalancers
import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
public Iterable<LoadBalancerMetadata> listLoadBalancers() {
Builder<LoadBalancerMetadata> builder = ImmutableSet.builder();
for (String region : api.getAvailableRegions()) {
IAcsClient client = api.getAcsClient(region);
DescribeLoadBalancersRequest req = new DescribeLoadBalancersRequest();
try {
List<LoadBalancer> list = client.getAcsResponse(req).getLoadBalancers();
builder.addAll(transform(list, new LoadBalancerToLoadBalancerMetadata(client, loadBalancerTypes)));
} catch (Exception e) {
logger.warn(e.getMessage());
}
}
return builder.build();
}
示例10: getAll
import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
public Set<T> getAll() {
Builder<T> builder = ImmutableSet.builder();
this.read_lock.lock();
try {
builder.addAll(this.types.values());
} finally {
this.read_lock.unlock();
}
return builder.build();
}
示例11: getAll
import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
public Collection<EntityTemplate.Property<?>> getAll() {
Builder<EntityTemplate.Property<?>> builder = ImmutableSet.builder();
this.read_lock.lock();
try {
builder.addAll(this.properties.values());
} finally {
this.read_lock.unlock();
}
return builder.build();
}
示例12: getAll
import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
public Set<EntityTemplate> getAll() {
Builder<EntityTemplate> builder = ImmutableSet.builder();
this.read_lock.lock();
try {
builder.addAll(this.entities.values());
} finally {
this.read_lock.unlock();
}
return builder.build();
}
示例13: getAll
import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
public Set<FireType> getAll() {
Builder<FireType> builder = ImmutableSet.builder();
this.read_lock.lock();
try {
builder.addAll(this.fires.values());
} finally {
this.read_lock.unlock();
}
return builder.build();
}
示例14: getBans
import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
public Collection<Ban> getBans() {
this.removeExpired();
Builder<Ban> builder = ImmutableSet.builder();
builder.addAll(this.bans_profile.keySet());
builder.addAll(this.bans_ip.keySet());
return builder.build();
}
示例15: getProfileBans
import com.google.common.collect.ImmutableSet.Builder; //导入方法依赖的package包/类
@Override
public Collection<Ban.Profile> getProfileBans() {
this.removeExpired();
Builder<Ban.Profile> builder = ImmutableSet.builder();
builder.addAll(this.bans_profile.keySet());
return builder.build();
}