本文整理匯總了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);
}