本文整理汇总了Java中org.apache.ignite.internal.util.typedef.internal.U.newHashSet方法的典型用法代码示例。如果您正苦于以下问题:Java U.newHashSet方法的具体用法?Java U.newHashSet怎么用?Java U.newHashSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.internal.util.typedef.internal.U
的用法示例。
在下文中一共展示了U.newHashSet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listFiles
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public Collection<IgfsFile> listFiles(IgfsPath path) {
File[] entries = listFiles0(path);
if (F.isEmpty(entries))
return Collections.emptySet();
else {
Collection<IgfsFile> res = U.newHashSet(entries.length);
for (File entry : entries) {
IgfsFile info = info(igfsPath(entry));
if (info != null)
res.add(info);
}
return res;
}
}
示例2: requestedKeys0
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @return Keys for which locks requested from remote nodes but response isn't received.
*/
private Set<IgniteTxKey> requestedKeys0() {
for (IgniteInternalFuture<Boolean> miniFut : futures()) {
if (isMini(miniFut) && !miniFut.isDone()) {
MiniFuture mini = (MiniFuture)miniFut;
Set<IgniteTxKey> requestedKeys = U.newHashSet(mini.keys.size());
for (KeyCacheObject key : mini.keys)
requestedKeys.add(new IgniteTxKey(key, cctx.cacheId()));
return requestedKeys;
}
}
return null;
}
示例3: requestedKeys
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @return Keys for which {@code MiniFuture} isn't completed.
*/
@SuppressWarnings("ForLoopReplaceableByForEach")
public Set<IgniteTxKey> requestedKeys() {
synchronized (this) {
int size = futuresCountNoLock();
for (int i = 0; i < size; i++) {
IgniteInternalFuture<GridNearTxPrepareResponse> fut = future(i);
if (isMini(fut) && !fut.isDone()) {
MiniFuture miniFut = (MiniFuture)fut;
Collection<IgniteTxEntry> entries = miniFut.mapping().entries();
Set<IgniteTxKey> keys = U.newHashSet(entries.size());
for (IgniteTxEntry entry : entries)
keys.add(entry.txKey());
return keys;
}
}
}
return null;
}
示例4: newKnownCollection
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Attempts to create a new collection of the same known type. Will return null if collection type is unknown.
*
* @param col Collection.
* @return New empty collection.
*/
@SuppressWarnings("unchecked")
public static <V> Collection<V> newKnownCollection(Object col) {
Class<?> cls = col == null ? null : col.getClass();
if (cls == HashSet.class)
return U.newHashSet(((Collection)col).size());
else if (cls == LinkedHashSet.class)
return U.newLinkedHashSet(((Collection)col).size());
else if (!wrapTrees() && cls == TreeSet.class)
return new TreeSet<>(((TreeSet<Object>)col).comparator());
else if (cls == ConcurrentSkipListSet.class)
return new ConcurrentSkipListSet<>(((ConcurrentSkipListSet<Object>)col).comparator());
else if (cls == ArrayList.class)
return new ArrayList<>(((Collection)col).size());
else if (cls == LinkedList.class)
return new LinkedList<>();
else if (cls == SINGLETON_LIST_CLS)
return new MutableSingletonList<>();
return null;
}
示例5: listPaths
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public Collection<IgfsPath> listPaths(IgfsPath path) {
File[] entries = listFiles0(path);
if (F.isEmpty(entries))
return Collections.emptySet();
else {
Collection<IgfsPath> res = U.newHashSet(entries.length);
for (File entry : entries)
res.add(igfsPath(entry));
return res;
}
}
示例6: readSet
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @param reader Reader.
* @return Set.
*/
public static <T> Set<T> readSet(BinaryRawReaderEx reader) {
int cnt = reader.readInt();
Set<T> res = U.newHashSet(cnt);
for (int i = 0; i < cnt; i++)
res.add((T)reader.readObjectDetached());
return res;
}
示例7: removeAll
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public boolean removeAll(Collection<?> c) {
onAccess();
boolean rmv = false;
Set<SetItemKey> rmvKeys = null;
for (Object obj : c) {
if (rmv) {
if (rmvKeys == null)
rmvKeys = U.newHashSet(BATCH_SIZE);
rmvKeys.add(itemKey(obj));
if (rmvKeys.size() == BATCH_SIZE) {
retryRemoveAll(rmvKeys);
rmvKeys.clear();
}
}
else
rmv = remove(obj);
}
if (!F.isEmpty(rmvKeys))
retryRemoveAll(rmvKeys);
return rmv;
}
示例8: GridNodePredicate
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Creates node predicate that evaluates to {@code true} for all
* provided node IDs. Implementation will make a defensive copy.
*
* @param ids Optional node IDs. If none provided - predicate will always return {@code false}.
*/
public GridNodePredicate(@Nullable UUID... ids) {
if (F.isEmpty(ids))
this.ids = Collections.emptySet();
else if (ids.length == 1)
this.ids = Collections.singleton(ids[0]);
else {
this.ids = U.newHashSet(ids.length);
Collections.addAll(this.ids, ids);
}
}
示例9: cacheIds
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @return IDs of caches in this group.
*/
public Set<Integer> cacheIds() {
List<GridCacheContext> caches = this.caches;
Set<Integer> ids = U.newHashSet(caches.size());
for (int i = 0; i < caches.size(); i++)
ids.add(caches.get(i).cacheId());
return ids;
}
示例10: forNodeId
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public final ClusterGroup forNodeId(UUID id, UUID... ids) {
A.notNull(id, "id");
guard();
try {
Set<UUID> nodeIds;
if (F.isEmpty(ids))
nodeIds = contains(id) ? Collections.singleton(id) : Collections.<UUID>emptySet();
else {
nodeIds = U.newHashSet(ids.length + 1);
for (UUID id0 : ids) {
if (contains(id))
nodeIds.add(id0);
}
if (contains(id))
nodeIds.add(id);
}
return new ClusterGroupAdapter(ctx, subjId, nodeIds);
}
finally {
unguard();
}
}
示例11: finishUnmarshal
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public void finishUnmarshal(GridCacheSharedContext ctx, ClassLoader ldr) throws IgniteCheckedException {
super.finishUnmarshal(ctx, ldr);
txKeys = U.newHashSet(txKeysArr.length);
for (IgniteTxKey key : txKeysArr) {
key.finishUnmarshal(ctx.cacheContext(key.cacheId()), ldr);
txKeys.add(key);
}
txKeysArr = null;
}
示例12: permissions
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* @param perms Permissions.
* @return Collection.
*/
private static Collection<SecurityPermission> permissions(SecurityPermission... perms) {
Collection<SecurityPermission> col = U.newHashSet(perms.length);
Collections.addAll(col, perms);
return col;
}
示例13: GridClientTopology
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Creates topology instance.
*
* @param cfg Client configuration.
*/
public GridClientTopology(GridClientConfiguration cfg) {
metricsCache = cfg.isEnableMetricsCache();
attrCache = cfg.isEnableAttributesCache();
prot = cfg.getProtocol();
if (!cfg.getRouters().isEmpty() && cfg.getServers().isEmpty()) {
routers = cfg.getRouters().toString();
routerAddrs = U.newHashSet(cfg.getRouters().size());
for (String router : cfg.getRouters()) {
int portIdx = router.lastIndexOf(":");
if (portIdx > 0) {
String hostName = router.substring(0, portIdx);
try {
int port = Integer.parseInt(router.substring(portIdx + 1));
InetSocketAddress inetSockAddr = new InetSocketAddress(hostName, port);
routerAddrs.add(inetSockAddr);
}
catch (Exception ignore) {
// No-op.
}
}
}
}
else {
routers = null;
routerAddrs = Collections.emptySet();
}
macsCache = U.allLocalMACs();
}
示例14: newSet
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/**
* Attempts to create a new set of the same type as {@code set} has. Otherwise returns new {@code HashSet}
* instance.
*
* @param set Original set.
* @return New set.
*/
public static <V> Set<V> newSet(Set<V> set) {
if (set instanceof LinkedHashSet)
return U.newLinkedHashSet(set.size());
else if (set instanceof TreeSet)
return new TreeSet<>(((TreeSet<Object>)set).comparator());
else if (set instanceof ConcurrentSkipListSet)
return new ConcurrentSkipListSet<>(((ConcurrentSkipListSet<Object>)set).comparator());
return U.newHashSet(set.size());
}
示例15: forNode
import org.apache.ignite.internal.util.typedef.internal.U; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override public final ClusterGroup forNode(ClusterNode node, ClusterNode... nodes) {
A.notNull(node, "node");
guard();
try {
Set<UUID> nodeIds;
if (F.isEmpty(nodes))
nodeIds = contains(node) ? Collections.singleton(node.id()) : Collections.<UUID>emptySet();
else {
nodeIds = U.newHashSet(nodes.length + 1);
for (ClusterNode n : nodes)
if (contains(n))
nodeIds.add(n.id());
if (contains(node))
nodeIds.add(node.id());
}
return new ClusterGroupAdapter(ctx, subjId, nodeIds);
}
finally {
unguard();
}
}