本文整理汇总了Java中com.google.common.collect.ImmutableCollection.size方法的典型用法代码示例。如果您正苦于以下问题:Java ImmutableCollection.size方法的具体用法?Java ImmutableCollection.size怎么用?Java ImmutableCollection.size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.ImmutableCollection
的用法示例。
在下文中一共展示了ImmutableCollection.size方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clearNodes
import com.google.common.collect.ImmutableCollection; //导入方法依赖的package包/类
/**
* Clear all of the holders permission nodes
*/
public boolean clearNodes() {
ImmutableCollection<Node> before = getEnduringNodes().values();
this.nodesLock.lock();
try {
this.nodes.clear();
} finally {
this.nodesLock.unlock();
}
invalidateCache();
ImmutableCollection<Node> after = getEnduringNodes().values();
if (before.size() == after.size()) {
return false;
}
this.plugin.getEventFactory().handleNodeClear(this, before, after);
return true;
}
示例2: clearTransientNodes
import com.google.common.collect.ImmutableCollection; //导入方法依赖的package包/类
public boolean clearTransientNodes() {
ImmutableCollection<Node> before = getTransientNodes().values();
this.transientNodesLock.lock();
try {
this.transientNodes.clear();
} finally {
this.transientNodesLock.unlock();
}
invalidateCache();
ImmutableCollection<Node> after = getTransientNodes().values();
if (before.size() == after.size()) {
return false;
}
this.plugin.getEventFactory().handleNodeClear(this, before, after);
return true;
}
示例3: RunningState
import com.google.common.collect.ImmutableCollection; //导入方法依赖的package包/类
RunningState(
ImmutableCollection<? extends ListenableFuture<? extends InputT>> futures,
boolean allMustSucceed,
boolean collectsValues) {
super(futures.size());
this.futures = checkNotNull(futures);
this.allMustSucceed = allMustSucceed;
this.collectsValues = collectsValues;
}
示例4: CollectionFutureRunningState
import com.google.common.collect.ImmutableCollection; //导入方法依赖的package包/类
CollectionFutureRunningState(
ImmutableCollection<? extends ListenableFuture<? extends V>> futures,
boolean allMustSucceed) {
super(futures, allMustSucceed, true);
this.values =
futures.isEmpty()
? ImmutableList.<Optional<V>>of()
: Lists.<Optional<V>>newArrayListWithCapacity(futures.size());
// Populate the results list with null initially.
for (int i = 0; i < futures.size(); ++i) {
values.add(null);
}
}
示例5: CollectionFutureRunningState
import com.google.common.collect.ImmutableCollection; //导入方法依赖的package包/类
CollectionFutureRunningState(
ImmutableCollection<? extends ListenableFuture<? extends V>> futures,
boolean allMustSucceed) {
super(futures, allMustSucceed, true);
this.values =
futures.isEmpty()
? ImmutableList.<Optional<V>>of()
: Lists.<Optional<V>>newArrayListWithCapacity(futures.size());
// Populate the results list with null initially.
for (int i = 0; i < futures.size(); ++i) {
values.add(null);
}
}
示例6: CollectionFutureRunningState
import com.google.common.collect.ImmutableCollection; //导入方法依赖的package包/类
CollectionFutureRunningState(
ImmutableCollection<? extends ListenableFuture<? extends V>> futures,
boolean allMustSucceed) {
super(futures, allMustSucceed, true);
this.values = futures.isEmpty()
? ImmutableList.<Optional<V>>of()
: Lists.<Optional<V>>newArrayListWithCapacity(futures.size());
// Populate the results list with null initially.
for (int i = 0; i < futures.size(); ++i) {
values.add(null);
}
}
示例7: findDirectDispatchTarget
import com.google.common.collect.ImmutableCollection; //导入方法依赖的package包/类
private static Optional<Node> findDirectDispatchTarget(String selfHostname,
int searchClusterSize,
int containerClusterSize,
ImmutableMultimap<String, Node>nodesByHost,
ImmutableMap<Integer, Group> groups) {
// A search node in the search cluster in question is configured on the same host as the currently running container.
// It has all the data <==> No other nodes in the search cluster have the same group id as this node.
// That local search node responds.
// The search cluster to be searched has at least as many nodes as the container cluster we're running in.
ImmutableCollection<Node> localSearchNodes = nodesByHost.get(selfHostname);
// Only use direct dispatch if we have exactly 1 search node on the same machine:
if (localSearchNodes.size() != 1) return Optional.empty();
SearchCluster.Node localSearchNode = localSearchNodes.iterator().next();
SearchCluster.Group localSearchGroup = groups.get(localSearchNode.group());
// Only use direct dispatch if the local search node has the entire corpus
if (localSearchGroup.nodes().size() != 1) return Optional.empty();
// Only use direct dispatch if this container cluster has at least as many nodes as the search cluster
// to avoid load skew/preserve fanout in the case where a subset of the search nodes are also containers.
// This disregards the case where the search and container clusters are partially overlapping.
// Such configurations produce skewed load in any case.
if (containerClusterSize < searchClusterSize) return Optional.empty();
return Optional.of(localSearchNode);
}
示例8: RunningState
import com.google.common.collect.ImmutableCollection; //导入方法依赖的package包/类
RunningState(ImmutableCollection<? extends ListenableFuture<? extends InputT>> futures, boolean allMustSucceed, boolean collectsValues) {
super(futures.size());
this.futures = checkNotNull(futures);
this.allMustSucceed = allMustSucceed;
this.collectsValues = collectsValues;
}
示例9: ServiceManagerState
import com.google.common.collect.ImmutableCollection; //导入方法依赖的package包/类
/**
* It is implicitly assumed that all the services are NEW and that they will all remain NEW
* until all the Listeners are installed and {@link #markReady()} is called. It is our caller's
* responsibility to only call {@link #markReady()} if all services were new at the time this
* method was called and when all the listeners were installed.
*/
ServiceManagerState(ImmutableCollection<Service> services) {
this.numberOfServices = services.size();
servicesByState.putAll(NEW, services);
}
示例10: ServiceManagerState
import com.google.common.collect.ImmutableCollection; //导入方法依赖的package包/类
/**
* It is implicitly assumed that all the services are NEW and that they will all remain NEW
* until all the Listeners are installed and {@link #markReady()} is called. It is our caller's
* responsibility to only call {@link #markReady()} if all services were new at the time this
* method was called and when all the listeners were installed.
*/
ServiceManagerState(ImmutableCollection<Service> services) {
this.numberOfServices = services.size();
servicesByState.putAll(NEW, services);
}