Java 类org.apache.commons.collections15.IteratorUtils 实例源码

项目:VarJ    文件:TestObjectGraphIterator.java   
public void testIteratorConstructorIteration_WithEmptyIterators() {
    List iteratorList = new ArrayList();
    iteratorList.add(IteratorUtils.EMPTY_ITERATOR);
    iteratorList.add(list1.iterator());
    iteratorList.add(IteratorUtils.EMPTY_ITERATOR);
    iteratorList.add(list2.iterator());
    iteratorList.add(IteratorUtils.EMPTY_ITERATOR);
    iteratorList.add(list3.iterator());
    iteratorList.add(IteratorUtils.EMPTY_ITERATOR);
    Iterator it = new ObjectGraphIterator(iteratorList.iterator());

    for (int i = 0; i < 6; i++) {
        assertEquals(true, it.hasNext());
        assertEquals(testArray[i], it.next());
    }
    assertEquals(false, it.hasNext());
    try {
        it.next();
        fail();
    } catch (NoSuchElementException ex) {
    }
}
项目:VarJ    文件:TestObjectGraphIterator.java   
public void testIteration_IteratorOfIteratorsWithEmptyIterators() {
    List iteratorList = new ArrayList();
    iteratorList.add(IteratorUtils.EMPTY_ITERATOR);
    iteratorList.add(list1.iterator());
    iteratorList.add(IteratorUtils.EMPTY_ITERATOR);
    iteratorList.add(list2.iterator());
    iteratorList.add(IteratorUtils.EMPTY_ITERATOR);
    iteratorList.add(list3.iterator());
    iteratorList.add(IteratorUtils.EMPTY_ITERATOR);
    Iterator it = new ObjectGraphIterator(iteratorList.iterator(), null);

    for (int i = 0; i < 6; i++) {
        assertEquals(true, it.hasNext());
        assertEquals(testArray[i], it.next());
    }
    assertEquals(false, it.hasNext());
}
项目:BfROpenLab    文件:MapBinaryHeap.java   
/**
 * Returns an <code>Iterator</code> that does not support modification
 * of the heap.
 */
@Override
public Iterator<T> iterator()
{
    return IteratorUtils.<T>unmodifiableIterator(heap.iterator());
}
项目:ODL    文件:MapBinaryHeap.java   
/**
 * Returns an <code>Iterator</code> that does not support modification
 * of the heap.
 */
@Override
public Iterator<T> iterator()
{
    return IteratorUtils.<T>unmodifiableIterator(heap.iterator());
}