Java 类org.apache.commons.collections.iterators.EmptyIterator 实例源码

项目:mars-sim    文件:CartesianProduct.java   
/**
 *  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 );
}
项目:mars-sim    文件:CartesianProduct.java   
/**
 *  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 );
}
项目:keepass2android    文件:AbstractHashedMap.java   
/**
 * 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);
}
项目:keepass2android    文件:AbstractHashedMap.java   
/**
 * 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);
}
项目:keepass2android    文件:AbstractHashedMap.java   
/**
 * 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);
}
项目:KeePass2Android    文件:AbstractHashedMap.java   
/**
 * 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);
}
项目:KeePass2Android    文件:AbstractHashedMap.java   
/**
 * 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);
}
项目:KeePass2Android    文件:AbstractHashedMap.java   
/**
 * 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);
}
项目:mars-sim    文件:Join.java   
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()
            } );
}
项目:ExpertFinder    文件:ExpertFinder.java   
/**
 * 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;
}
项目:ExpertFinder    文件:ExpertFinder.java   
/**
 * 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;
}
项目:java-util-examples    文件:ReturnEmptyIterator.java   
/**
 * 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;
    }

    //...
}
项目:usergrid    文件:ServicePayload.java   
@SuppressWarnings("unchecked")
public Iterator<Map<String, Object>> payloadIterator() {
    if ( isBatch() ) {
        return batch.iterator();
    }
    if ( properties != null ) {
        return new SingletonListIterator( properties );
    }
    return EmptyIterator.INSTANCE;
}
项目:levelup-java-examples    文件:ReturnEmptyIterator.java   
/**
 * 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;
    }

    //...
}
项目:mars-sim    文件:AbstractSingletonCollection.java   
public Iterator iterator()
{
    return isEmpty()
        ? EmptyIterator.INSTANCE
        : new IteratorImpl( this );
}
项目:mars-sim    文件:CompleteTree.java   
public Iterator iterator()
{
    return getHeight() == 0 ? EmptyIterator.INSTANCE : new EdgeIterator();
}
项目:mars-sim    文件:CompleteGraph.java   
public Iterator iterator()
{
    return getNodeSize() < 2 ? EmptyIterator.INSTANCE : new EdgeIterator();
}
项目:Kaboom    文件:RDMPropertyCollection.java   
@SuppressWarnings("unchecked")
@Override
public Iterator<RDMProperty> iterator() {
    return isEmpty() ? EmptyIterator.INSTANCE : rdmProperties.iterator();
}
项目:playweb    文件:Iterators.java   
/**
 * Returns an empty iterator of type <code>T</code>.
 *
 * @param <T>
 * @return
 */
@SuppressWarnings("unchecked")
public static <T> Iterator<T> empty() {
    return EmptyIterator.INSTANCE;
}