Package com.alibaba.toolkit.util.collection

Examples of com.alibaba.toolkit.util.collection.ArrayHashSet


     *
     * @return resource��URL����, ���û�ҵ�, �򷵻ؿ�����. �����б�֤�������ظ���URL.
     */
    public static URL[] getResources(String resourceName) {
        ClassLoader classLoader = null;
        Set         urlSet = new ArrayHashSet();
        boolean     found  = false;


        // �������Ŵӵ�ǰ�̵߳�ClassLoader�в���.
        found = getResources(urlSet, resourceName, getClassLoader(), false);

        // ���û�ҵ�, ���Ŵ�װ���Լ���ClassLoader�в���.
        if (!found) {
            getResources(urlSet, resourceName, ContextClassLoader.class.getClassLoader(), false);
        }

        // ���ij���: ��ϵͳClassLoader�в���(JDK1.2����),
        // ������JDK���ڲ�ClassLoader�в���(JDK1.2����).
        if (!found) {
            getResources(urlSet, resourceName, null, true);
        }

        if (found) {
            return (URL[]) urlSet.toArray(new URL[urlSet.size()]);
        }

        return new URL[0];
    }
View Full Code Here


        }

        // ȡ������interface
        if (dimension == 0) {
            Class[] typeInterfaces = type.getInterfaces();
            Set     set = new ArrayHashSet();

            for (int i = 0; i < typeInterfaces.length; i++) {
                Class typeInterface = typeInterfaces[i];

                set.add(typeInterface);
                set.addAll(getTypeInfo(typeInterface).interfaces);
            }

            for (Iterator i = superclasses.iterator(); i.hasNext();) {
                Class typeInterface = (Class) i.next();

                set.addAll(getTypeInfo(typeInterface).interfaces);
            }

            interfaces.addAll(set);
        }
    }
View Full Code Here

    /**
     * �ų�ָ�����ļ���
     */
    public PatternSet addExcludes(String[] addedExcludes) {
        Set excludeSet = new ArrayHashSet();

        for (int i = 0; i < excludes.length; i++) {
            excludeSet.add(excludes[i]);
        }

        for (int i = 0; i < addedExcludes.length; i++) {
            excludeSet.add(addedExcludes[i]);
        }

        excludes = (String[]) excludeSet.toArray(new String[excludeSet.size()]);

        return this;
    }
View Full Code Here

     * @param resourceName 要查找的资源名, 就是以&quot;/&quot;分隔的标识符字符串
     * @return resource的URL数组, 如果没找到, 则返回空数组. 数组中保证不包含重复的URL.
     */
    public static URL[] getResources(String resourceName) {
        ClassLoader classLoader = null;
        Set urlSet = new ArrayHashSet();
        boolean found = false;

        // 首先试着从当前线程的ClassLoader中查找.
        found = getResources(urlSet, resourceName, getClassLoader(), false);

        // 如果没找到, 试着从装入自己的ClassLoader中查找.
        if (!found) {
            getResources(urlSet, resourceName, ContextClassLoader.class.getClassLoader(), false);
        }

        // 最后的尝试: 在系统ClassLoader中查找(JDK1.2以上),
        // 或者在JDK的内部ClassLoader中查找(JDK1.2以下).
        if (!found) {
            getResources(urlSet, resourceName, null, true);
        }

        if (found) {
            return (URL[]) urlSet.toArray(new URL[urlSet.size()]);
        }

        return new URL[0];
    }
View Full Code Here

        }

        // 取得所有interface
        if (dimension == 0) {
            Class[] typeInterfaces = type.getInterfaces();
            Set set = new ArrayHashSet();

            for (Class typeInterface : typeInterfaces) {
                set.add(typeInterface);
                set.addAll(getTypeInfo(typeInterface).interfaces);
            }

            for (Iterator i = superclasses.iterator(); i.hasNext(); ) {
                Class typeInterface = (Class) i.next();

                set.addAll(getTypeInfo(typeInterface).interfaces);
            }

            interfaces.addAll(set);
        }
    }
View Full Code Here

        return (String[]) patternList.toArray(new String[patternList.size()]);
    }

    /** 排除指定的文件。 */
    public PatternSet addExcludes(String[] addedExcludes) {
        Set excludeSet = new ArrayHashSet();

        for (String exclude : excludes) {
            excludeSet.add(exclude);
        }

        for (String addedExclude : addedExcludes) {
            excludeSet.add(addedExclude);
        }

        excludes = (String[]) excludeSet.toArray(new String[excludeSet.size()]);

        return this;
    }
View Full Code Here

    /**
     * �ų�ָ�����ļ���
     */
    public PatternSet addExcludes(String[] addedExcludes) {
        Set excludeSet = new ArrayHashSet();

        for (int i = 0; i < excludes.length; i++) {
            excludeSet.add(excludes[i]);
        }

        for (int i = 0; i < addedExcludes.length; i++) {
            excludeSet.add(addedExcludes[i]);
        }

        excludes = (String[]) excludeSet.toArray(new String[excludeSet.size()]);

        return this;
    }
View Full Code Here

     *
     * @return resource��URL����, ���û�ҵ�, �򷵻ؿ�����. �����б�֤�������ظ���URL.
     */
    public static URL[] getResources(String resourceName) {
        ClassLoader classLoader = null;
        Set         urlSet = new ArrayHashSet();
        boolean     found  = false;


        // �������Ŵӵ�ǰ�̵߳�ClassLoader�в���.
        found = getResources(urlSet, resourceName, getClassLoader(), false);

        // ���û�ҵ�, ���Ŵ�װ���Լ���ClassLoader�в���.
        if (!found) {
            getResources(urlSet, resourceName, ContextClassLoader.class.getClassLoader(), false);
        }

        // ���ij���: ��ϵͳClassLoader�в���(JDK1.2����),
        // ������JDK���ڲ�ClassLoader�в���(JDK1.2����).
        if (!found) {
            getResources(urlSet, resourceName, null, true);
        }

        if (found) {
            return (URL[]) urlSet.toArray(new URL[urlSet.size()]);
        }

        return new URL[0];
    }
View Full Code Here

        }

        // ȡ������interface
        if (dimension == 0) {
            Class[] typeInterfaces = type.getInterfaces();
            Set     set = new ArrayHashSet();

            for (int i = 0; i < typeInterfaces.length; i++) {
                Class typeInterface = typeInterfaces[i];

                set.add(typeInterface);
                set.addAll(getTypeInfo(typeInterface).interfaces);
            }

            for (Iterator i = superclasses.iterator(); i.hasNext();) {
                Class typeInterface = (Class) i.next();

                set.addAll(getTypeInfo(typeInterface).interfaces);
            }

            interfaces.addAll(set);
        }
    }
View Full Code Here

TOP

Related Classes of com.alibaba.toolkit.util.collection.ArrayHashSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.