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


Java EmptyIterator类代码示例

本文整理汇总了Java中org.apache.commons.collections.iterators.EmptyIterator的典型用法代码示例。如果您正苦于以下问题:Java EmptyIterator类的具体用法?Java EmptyIterator怎么用?Java EmptyIterator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EmptyIterator类属于org.apache.commons.collections.iterators包,在下文中一共展示了EmptyIterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: leftIterator

import org.apache.commons.collections.iterators.EmptyIterator; //导入依赖的package包/类
/**
 *  Returns an <code>Iterator</code> over the elements of the
 *  product of the specified collections with the left one
 *  controlling the outer loop.  This factory method is preferable
 *  when the left collection is more expensive to use than the
 *  right one.
 */
public static final Iterator leftIterator( Collection left, Collection right )
{
    if( left == null ) {
        throw new IllegalArgumentException( "Left operand is null." );
    }
    if( right == null ) {
        throw new IllegalArgumentException( "Right operand is null." );
    }
    Iterator leftIter = left.iterator();
    // We have to check for this case, because passing an empty
    // right collection to the Iterator constructor would result
    // in incorrect behavior for hasNext() as it is written.  The
    // alternative is a more complex Iterator implementation.
    if( !leftIter.hasNext() || right.isEmpty() ) {
        return EmptyIterator.INSTANCE;
    }
    return new LeftIterator( leftIter, right );
}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:26,代码来源:CartesianProduct.java

示例2: rightIterator

import org.apache.commons.collections.iterators.EmptyIterator; //导入依赖的package包/类
/**
 *  Returns an <code>Iterator</code> over the elements of the
 *  product of the specified collections with the right one
 *  controlling the outer loop.  This factory method is preferable
 *  when the right collection is more expensive to use than the
 *  left one.
 */
public static final Iterator rightIterator( Collection left, Collection right )
{
    if( left == null ) {
        throw new IllegalArgumentException( "Left operand is null." );
    }
    if( right == null ) {
        throw new IllegalArgumentException( "Right operand is null." );
    }
    Iterator rightIter = right.iterator();
    // We have to check for this case, because passing an empty
    // left collection to the Iterator constructor would result
    // in incorrect behavior for hasNext() as it is written.  The
    // alternative is a more complex Iterator implementation.
    if( !rightIter.hasNext() || left.isEmpty() ) {
        return EmptyIterator.INSTANCE;
    }
    return new RightIterator( left, rightIter );
}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:26,代码来源:CartesianProduct.java

示例3: createEntrySetIterator

import org.apache.commons.collections.iterators.EmptyIterator; //导入依赖的package包/类
/**
 * Creates an entry set iterator.
 * Subclasses can override this to return iterators with different properties.
 * 
 * @return the entrySet iterator
 */
protected Iterator createEntrySetIterator() {
    if (size() == 0) {
        return EmptyIterator.INSTANCE;
    }
    return new EntrySetIterator(this);
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:13,代码来源:AbstractHashedMap.java

示例4: createKeySetIterator

import org.apache.commons.collections.iterators.EmptyIterator; //导入依赖的package包/类
/**
 * Creates a key set iterator.
 * Subclasses can override this to return iterators with different properties.
 * 
 * @return the keySet iterator
 */
protected Iterator createKeySetIterator() {
    if (size() == 0) {
        return EmptyIterator.INSTANCE;
    }
    return new KeySetIterator(this);
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:13,代码来源:AbstractHashedMap.java

示例5: createValuesIterator

import org.apache.commons.collections.iterators.EmptyIterator; //导入依赖的package包/类
/**
 * Creates a values iterator.
 * Subclasses can override this to return iterators with different properties.
 * 
 * @return the values iterator
 */
protected Iterator createValuesIterator() {
    if (size() == 0) {
        return EmptyIterator.INSTANCE;
    }
    return new ValuesIterator(this);
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:13,代码来源:AbstractHashedMap.java

示例6: iterator

import org.apache.commons.collections.iterators.EmptyIterator; //导入依赖的package包/类
public Iterator iterator()
{
    return isEmpty()
        ? EmptyIterator.INSTANCE
        : new IteratorChain( new Iterator[]
            {
                new UnmodifiableIterator( left.edges( null ).iterator() ),
                new UnmodifiableIterator( right.edges( null ).iterator() ),
                new CrossEdgeIterator()
            } );
}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:12,代码来源:Join.java

示例7: getSuperClasses

import org.apache.commons.collections.iterators.EmptyIterator; //导入依赖的package包/类
/**
 * Returns an iterator over all super classes of the class specified by the
 * given uri or an empty iterator if no such class exists or if it has no
 * super classes.
 * 
 * @param uri
 * @return an iterator over all super classes of the class specified by the
 *         given uri or an empty iterator if no such class exists or if it
 *         has no super classes.
 */
@SuppressWarnings("unchecked")
public Iterator<OntClass> getSuperClasses(String uri) {
	OntModel model = OntologyIndex.get().getModel();
	OntClass clazz = model.getOntClass(uri);
	if (clazz != null) {
		return clazz.listSuperClasses(true);
	}
	
	return EmptyIterator.INSTANCE;
}
 
开发者ID:ag-csw,项目名称:ExpertFinder,代码行数:21,代码来源:ExpertFinder.java

示例8: getSubClasses

import org.apache.commons.collections.iterators.EmptyIterator; //导入依赖的package包/类
/**
 * Returns an iterator over all subclasses of the class specified by the
 * given uri or an empty iterator if no such class exists or if it has no
 * subclasses.
 * 
 * @param uri
 * @return an iterator over all super classes of the class specified by the
 *         given uri or an empty iterator if no such class exists or if it
 *         has no super classes.
 */
@SuppressWarnings("unchecked")
public Iterator<OntClass> getSubClasses(String uri) {
	OntModel model = OntologyIndex.get().getModel();
	OntClass clazz = model.getOntClass(uri);
	if (clazz != null) {
		return clazz.listSubClasses(true);
	}
	
	return EmptyIterator.INSTANCE;
}
 
开发者ID:ag-csw,项目名称:ExpertFinder,代码行数:21,代码来源:ExpertFinder.java

示例9: return_empty_iterator_apache_commons_exception

import org.apache.commons.collections.iterators.EmptyIterator; //导入依赖的package包/类
/**
 * Used for exception example
 */
@SuppressWarnings({ "unchecked", "unused" })
private void return_empty_iterator_apache_commons_exception () {
	
	DomainObject domain = null; // dao populate domain

	Iterator<String> strings;
	if (domain != null && !CollectionUtils.sizeIsEmpty(domain.getStrings())) {
		strings = domain.getStrings();
	} else {
		strings = EmptyIterator.INSTANCE;
	}
	
	//...
}
 
开发者ID:wq19880601,项目名称:java-util-examples,代码行数:18,代码来源:ReturnEmptyIterator.java

示例10: payloadIterator

import org.apache.commons.collections.iterators.EmptyIterator; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public Iterator<Map<String, Object>> payloadIterator() {
    if ( isBatch() ) {
        return batch.iterator();
    }
    if ( properties != null ) {
        return new SingletonListIterator( properties );
    }
    return EmptyIterator.INSTANCE;
}
 
开发者ID:apache,项目名称:usergrid,代码行数:11,代码来源:ServicePayload.java

示例11: iterator

import org.apache.commons.collections.iterators.EmptyIterator; //导入依赖的package包/类
public Iterator iterator()
{
    return isEmpty()
        ? EmptyIterator.INSTANCE
        : new IteratorImpl( this );
}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:7,代码来源:AbstractSingletonCollection.java

示例12: iterator

import org.apache.commons.collections.iterators.EmptyIterator; //导入依赖的package包/类
public Iterator iterator()
{
    return getHeight() == 0 ? EmptyIterator.INSTANCE : new EdgeIterator();
}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:5,代码来源:CompleteTree.java

示例13: iterator

import org.apache.commons.collections.iterators.EmptyIterator; //导入依赖的package包/类
public Iterator iterator()
{
    return getNodeSize() < 2 ? EmptyIterator.INSTANCE : new EdgeIterator();
}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:5,代码来源:CompleteGraph.java

示例14: iterator

import org.apache.commons.collections.iterators.EmptyIterator; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public Iterator<RDMProperty> iterator() {
	return isEmpty() ? EmptyIterator.INSTANCE : rdmProperties.iterator();
}
 
开发者ID:ModelSolv,项目名称:Kaboom,代码行数:6,代码来源:RDMPropertyCollection.java

示例15: empty

import org.apache.commons.collections.iterators.EmptyIterator; //导入依赖的package包/类
/**
 * Returns an empty iterator of type <code>T</code>.
 *
 * @param <T>
 * @return
 */
@SuppressWarnings("unchecked")
public static <T> Iterator<T> empty() {
    return EmptyIterator.INSTANCE;
}
 
开发者ID:hlta,项目名称:playweb,代码行数:11,代码来源:Iterators.java


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