当前位置: 首页>>代码示例>>Java>>正文


Java U.newHashSet方法代码示例

本文整理汇总了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;
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:20,代码来源:LocalIgfsSecondaryFileSystem.java

示例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;
}
 
开发者ID:apache,项目名称:ignite,代码行数:20,代码来源:GridNearLockFuture.java

示例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;
}
 
开发者ID:apache,项目名称:ignite,代码行数:29,代码来源:GridNearOptimisticTxPrepareFuture.java

示例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;
}
 
开发者ID:apache,项目名称:ignite,代码行数:28,代码来源:BinaryUtils.java

示例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;
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:16,代码来源:LocalIgfsSecondaryFileSystem.java

示例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;
}
 
开发者ID:apache,项目名称:ignite,代码行数:15,代码来源:PlatformUtils.java

示例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;
}
 
开发者ID:apache,项目名称:ignite,代码行数:31,代码来源:GridCacheSetImpl.java

示例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);
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:18,代码来源:GridNodePredicate.java

示例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;
}
 
开发者ID:apache,项目名称:ignite,代码行数:14,代码来源:CacheGroupContext.java

示例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();
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:30,代码来源:ClusterGroupAdapter.java

示例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;
}
 
开发者ID:apache,项目名称:ignite,代码行数:15,代码来源:TxLocksRequest.java

示例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;
}
 
开发者ID:apache,项目名称:ignite,代码行数:12,代码来源:SecurityPermissionSetBuilderTest.java

示例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();
}
 
开发者ID:apache,项目名称:ignite,代码行数:43,代码来源:GridClientTopology.java

示例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());
}
 
开发者ID:apache,项目名称:ignite,代码行数:18,代码来源:BinaryUtils.java

示例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();
    }
}
 
开发者ID:apache,项目名称:ignite,代码行数:29,代码来源:ClusterGroupAdapter.java


注:本文中的org.apache.ignite.internal.util.typedef.internal.U.newHashSet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。