org.apache.commons.collections4.iterators.EnumerationIterator Java Examples

The following examples show how to use org.apache.commons.collections4.iterators.EnumerationIterator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BCELBenchmark.java    From commons-bcel with Apache License 2.0 5 votes vote down vote up
private Iterable<JarEntry> getClasses(JarFile jar) {
    return new IteratorIterable<>(new FilterIterator<>(new EnumerationIterator<>(jar.entries()), new Predicate<JarEntry>() {
        @Override
        public boolean evaluate(JarEntry entry) {
            return entry.getName().endsWith(".class");
        }
    }));
}
 
Example #2
Source File: UtilMisc.java    From scipio-erp with Apache License 2.0 4 votes vote down vote up
/**
 * SCIPIO: Wraps an Enumeration in an Iterator.
 */
public static <T> Iterator<T> toIterator(Enumeration<T> enumeration) {
    return new EnumerationIterator<T>(enumeration);
}
 
Example #3
Source File: ParameterParser.java    From sakai with Educational Community License v2.0 2 votes vote down vote up
/**
 * Access the parameter names.
 * 
 * @return An Iterator of parameter names (String).
 */
public Iterator<String> getNames()
{
	return new EnumerationIterator(m_req.getParameterNames());
}
 
Example #4
Source File: EnumerationUtil.java    From feilong-core with Apache License 2.0 2 votes vote down vote up
/**
 * 判断<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 isNotNullOrEmpty(enumeration) && IteratorUtils.contains(new EnumerationIterator<O>(enumeration), value);
}
 
Example #5
Source File: ParameterParser.java    From sakai with Educational Community License v2.0 2 votes vote down vote up
/**
 * Access the parameter names.
 * 
 * @return An Iterator of parameter names (String).
 */
public Iterator<String> getNames()
{
	return new EnumerationIterator(m_req.getParameterNames());
}