Java 类org.apache.commons.collections4.iterators.EnumerationIterator 实例源码

项目:Mod-Tools    文件:ZipContentParser.java   
@Override
public List<ProcessTask> handle(EntityManager manager) throws Exception {
    if (!file.exists()) {
        return todo;
    }
    try (ZipFile zip = new ZipFile(file)) {
        for (ZipArchiveEntry entry : new IteratorIterable<>(new EnumerationIterator<>(zip.getEntries()))) {
            try {
                handleSingleZipEntry(zip, entry, manager);
            } catch (IOException ex) {
                System.out.println(ex.getLocalizedMessage());
            }
        }
    }
    return todo;
}
项目:GitDirStat    文件:TreeObjectsTreeModel.java   
@Override
public Object transform(Object input) {
    fireTreeStructureChanged();
    if (input instanceof TreeObject) {
        TreeObject treeObject = (TreeObject) input;
        if (treeObject.isFile()) {
            return treeObject;
        } else {
            return new EnumerationIterator<TreeObject>(
                    treeObject.children());
        }
    }
    Class<?> clazz = null;
    if (input != null) {
        clazz = input.getClass();
    }
    throw new ClassCastException("Can only handle TreeObjects but was "
            + clazz);
}
项目:GitDirStat    文件:TreeObjectsTreeModel.java   
@Override
public Object transform(Object input) {
    fireTreeStructureChanged();
    if (input instanceof TreeObject) {
        TreeObject treeObject = (TreeObject) input;
        if (treeObject.isFile()) {
            return treeObject;
        } else {
            return new EnumerationIterator<TreeObject>(
                    treeObject.children());
        }
    }
    Class<?> clazz = null;
    if (input != null) {
        clazz = input.getClass();
    }
    throw new ClassCastException("Can only handle TreeObjects but was "
            + clazz);
}
项目:HCFCore    文件:IteratorUtils.java   
/**
 * Gets an iterator that provides an iterator view of the given enumeration
 * that will remove elements from the specified collection.
 *
 * @param <E> the element type
 * @param enumeration  the enumeration to use, may not be null
 * @param removeCollection  the collection to remove elements from, may not be null
 * @return a new iterator
 * @throws NullPointerException if enumeration or removeCollection is null
 */
public static <E> Iterator<E> asIterator(final Enumeration<? extends E> enumeration,
                                         final Collection<? super E> removeCollection) {
    if (enumeration == null) {
        throw new NullPointerException("Enumeration must not be null");
    }
    if (removeCollection == null) {
        throw new NullPointerException("Collection must not be null");
    }
    return new EnumerationIterator<E>(enumeration, removeCollection);
}
项目:HCFCore    文件:IteratorUtils.java   
/**
 * Gets an iterator that provides an iterator view of the given enumeration
 * that will remove elements from the specified collection.
 *
 * @param <E> the element type
 * @param enumeration  the enumeration to use, may not be null
 * @param removeCollection  the collection to remove elements from, may not be null
 * @return a new iterator
 * @throws NullPointerException if enumeration or removeCollection is null
 */
public static <E> Iterator<E> asIterator(final Enumeration<? extends E> enumeration,
                                         final Collection<? super E> removeCollection) {
    if (enumeration == null) {
        throw new NullPointerException("Enumeration must not be null");
    }
    if (removeCollection == null) {
        throw new NullPointerException("Collection must not be null");
    }
    return new EnumerationIterator<E>(enumeration, removeCollection);
}
项目:HCFCore    文件:IteratorUtils.java   
/**
 * Gets an iterator that provides an iterator view of the given enumeration.
 *
 * @param <E> the element type
 * @param enumeration  the enumeration to use, may not be null
 * @return a new iterator
 * @throws NullPointerException if enumeration is null
 */
public static <E> Iterator<E> asIterator(final Enumeration<? extends E> enumeration) {
    if (enumeration == null) {
        throw new NullPointerException("Enumeration must not be null");
    }
    return new EnumerationIterator<E>(enumeration);
}
项目:HCFCore    文件:IteratorUtils.java   
/**
 * Gets an iterator that provides an iterator view of the given enumeration.
 *
 * @param <E> the element type
 * @param enumeration  the enumeration to use, may not be null
 * @return a new iterator
 * @throws NullPointerException if enumeration is null
 */
public static <E> Iterator<E> asIterator(final Enumeration<? extends E> enumeration) {
    if (enumeration == null) {
        throw new NullPointerException("Enumeration must not be null");
    }
    return new EnumerationIterator<E>(enumeration);
}
项目:HCFCore    文件:EnumerationUtils.java   
/**
 * Creates a list based on an enumeration.
 *
 * <p>As the enumeration is traversed, an ArrayList of its values is
 * created. The new list is returned.</p>
 *
 * @param <E> the element type
 * @param enumeration  the enumeration to traverse, which should not be <code>null</code>.
 * @return a list containing all elements of the given enumeration
 * @throws NullPointerException if the enumeration parameter is <code>null</code>.
 */
public static <E> List<E> toList(final Enumeration<? extends E> enumeration) {
    return IteratorUtils.toList(new EnumerationIterator<E>(enumeration));
}
项目:HCFCore    文件:EnumerationUtils.java   
/**
 * Creates a list based on an enumeration.
 *
 * <p>As the enumeration is traversed, an ArrayList of its values is
 * created. The new list is returned.</p>
 *
 * @param <E> the element type
 * @param enumeration  the enumeration to traverse, which should not be <code>null</code>.
 * @return a list containing all elements of the given enumeration
 * @throws NullPointerException if the enumeration parameter is <code>null</code>.
 */
public static <E> List<E> toList(final Enumeration<? extends E> enumeration) {
    return IteratorUtils.toList(new EnumerationIterator<E>(enumeration));
}
项目:feilong-core    文件:EnumerationUtil.java   
/**
 * 判断<code>enumeration</code>枚举里面,是否有指定的元素<code>value</code>.
 * 
 * <h3>示例:</h3>
 * 
 * <blockquote>
 * 
 * <pre class="code">
 * EnumerationUtil.contains(null, "a")                                          =   false
 * 
 * EnumerationUtil.contains(toEnumeration(toList("4", "5")), "a")               =   false
 * EnumerationUtil.contains(toEnumeration(toList("4", "5")), "4")               =   true
 * EnumerationUtil.contains(toEnumeration(toList("4", "5", "")), "")            =   true
 * EnumerationUtil.contains(toEnumeration(toList("4", "5", "", null)), null)    =   true
 * </pre>
 * 
 * </blockquote>
 *
 * @param <O>
 *            the generic type
 * @param enumeration
 *            the enumeration
 * @param value
 *            指定的元素
 * @return 如果 <code>enumeration</code> 是null或者empty,返回 false<br>
 *         否则如果 contains 返回true,<br>
 *         其他返回false
 * @see "org.springframework.util.CollectionUtils#contains(Enumeration, Object)"
 * @see org.apache.commons.collections4.iterators.EnumerationIterator
 * @see org.apache.commons.collections4.IteratorUtils#contains(java.util.Iterator, Object)
 */
public static <O> boolean contains(Enumeration<O> enumeration,O value){
    return isNullOrEmpty(enumeration) ? false : IteratorUtils.contains(new EnumerationIterator<O>(enumeration), value);
}
项目:sakai    文件:ParameterParser.java   
/**
 * Access the parameter names.
 * 
 * @return An Iterator of parameter names (String).
 */
public Iterator<String> getNames()
{
    return new EnumerationIterator(m_req.getParameterNames());
}
项目:sakai    文件:ParameterParser.java   
/**
 * Access the parameter names.
 * 
 * @return An Iterator of parameter names (String).
 */
public Iterator<String> getNames()
{
    return new EnumerationIterator(m_req.getParameterNames());
}