/** * Gets a list iterator based on a simple iterator. * <p> * As the wrapped Iterator is traversed, a LinkedList of its values is * cached, permitting all required operations of ListIterator. * * @param iterator the iterator to use, not null * @return a new iterator * @throws NullPointerException if iterator parameter is null */ public static ListIterator toListIterator(Iterator iterator) { if (iterator == null) { throw new NullPointerException("Iterator must not be null"); } return new ListIteratorWrapper(iterator); }
/** * Gets a list iterator based on a simple iterator. * <p> * As the wrapped Iterator is traversed, a LinkedList of its values is * cached, permitting all required operations of ListIterator. * * @param iterator the iterator to use, not null * @return a new iterator * @throws NullPointerException if iterator parameter is null */ public static ListIterator toListIterator(Iterator iterator) { if (iterator == null) { throw new NullPointerException("Iterator must not be null"); } return new ListIteratorWrapper(iterator); }
public Iterator makeFullIterator() { Iterator i = list1.iterator(); return new ListIteratorWrapper(i); }
public Iterator makeEmptyIterator() { ArrayList list = new ArrayList(); return new ListIteratorWrapper(list.iterator()); }
private boolean nextGroups(OuterJoinType outerJoinType) throws IOException { if (outerJoinType == OuterJoinType.FULL) { return nextGroups(); } else if (outerJoinType == OuterJoinType.LEFT) { boolean leftContainsElements = false; while (!leftContainsElements && nextGroups()) { currLeftIterator = new ListIteratorWrapper(currLeftSubset.iterator()); if (currLeftIterator.next() != null) { leftContainsElements = true; } currLeftIterator.reset(); } return leftContainsElements; } else if (outerJoinType == OuterJoinType.RIGHT) { boolean rightContainsElements = false; while (!rightContainsElements && nextGroups()) { currRightIterator = new ListIteratorWrapper(currRightSubset.iterator()); if (currRightIterator.next() != null) { rightContainsElements = true; } currRightIterator.reset(); } return rightContainsElements; } else { throw new IllegalArgumentException("Outer join of type '" + outerJoinType + "' not supported."); } }
@SuppressWarnings("unchecked") private boolean next() throws IOException { boolean hasMoreElements; if ((currLeftIterator == null || !currLeftIterator.hasNext()) && (currRightIterator == null || !currRightIterator.hasNext())) { hasMoreElements = nextGroups(outerJoinType); if (hasMoreElements) { if (outerJoinType != OuterJoinType.LEFT) { currLeftIterator = new ListIteratorWrapper(currLeftSubset.iterator()); } leftReturn = (IN1) currLeftIterator.next(); if (outerJoinType != OuterJoinType.RIGHT) { currRightIterator = new ListIteratorWrapper(currRightSubset.iterator()); } rightReturn = (IN2) currRightIterator.next(); return true; } else { //no more elements return false; } } else if (currLeftIterator.hasNext() && !currRightIterator.hasNext()) { leftReturn = (IN1) currLeftIterator.next(); currRightIterator.reset(); rightReturn = (IN2) currRightIterator.next(); return true; } else { rightReturn = (IN2) currRightIterator.next(); return true; } }
/** * Gets a list iterator based on a simple iterator. * <p> * As the wrapped Iterator is traversed, a LinkedList of its values is * cached, permitting all required operations of ListIterator. * * @param iterator the iterator to use, not null * @return a new iterator * @throws NullPointerException if iterator parameter is null */ public static ListIterator toListIterator(Iterator iterator) { if (iterator == null) { throw new NullPointerException("Iterator must not be null"); } return new ListIteratorWrapper(iterator); }
/** * Gets a list iterator based on a simple iterator. * <p> * As the wrapped Iterator is traversed, a LinkedList of its values is * cached, permitting all required operations of ListIterator. * * @param iterator the iterator to use, not null * @return a new iterator * @throws NullPointerException if iterator parameter is null */ public static ListIterator toListIterator(Iterator iterator) { if (iterator == null) { throw new NullPointerException("Iterator must not be null"); } return new ListIteratorWrapper(iterator); }
/** * Gets a list iterator based on a simple iterator. * <p> * As the wrapped Iterator is traversed, a LinkedList of its values is * cached, permitting all required operations of ListIterator. * * @param iterator the iterator to use, not null * @return a new iterator * @throws NullPointerException if iterator parameter is null */ public static ListIterator toListIterator(Iterator iterator) { if (iterator == null) { throw new NullPointerException("Iterator must not be null"); } return new ListIteratorWrapper(iterator); }
/** * Gets a list iterator based on a simple iterator. * <p> * As the wrapped Iterator is traversed, a LinkedList of its values is * cached, permitting all required operations of ListIterator. * * @param iterator the iterator to use, not null * @return a new iterator * @throws NullPointerException if iterator parameter is null */ public static ListIterator toListIterator(Iterator iterator) { if (iterator == null) { throw new NullPointerException("Iterator must not be null"); } return new ListIteratorWrapper(iterator); }
/** * Gets a list iterator based on a simple iterator. * <p> * As the wrapped Iterator is traversed, a LinkedList of its values is * cached, permitting all required operations of ListIterator. * * @param iterator the iterator to use, not null * @return a new iterator * @throws NullPointerException if iterator parameter is null */ public static ListIterator toListIterator(Iterator iterator) { if (iterator == null) { throw new NullPointerException("Iterator must not be null"); } return new ListIteratorWrapper(iterator); }
/** * Gets a list iterator based on a simple iterator. * <p> * As the wrapped Iterator is traversed, a LinkedList of its values is * cached, permitting all required operations of ListIterator. * * @param iterator the iterator to use, not null * @return a new iterator * @throws NullPointerException if iterator parameter is null */ public static ListIterator toListIterator(Iterator iterator) { if (iterator == null) { throw new NullPointerException("Iterator must not be null"); } return new ListIteratorWrapper(iterator); }
/** * Gets a list iterator based on a simple iterator. * <p> * As the wrapped Iterator is traversed, a LinkedList of its values is * cached, permitting all required operations of ListIterator. * * @param iterator the iterator to use, not null * @return a new iterator * @throws NullPointerException if iterator parameter is null */ public static ListIterator toListIterator(Iterator iterator) { if (iterator == null) { throw new NullPointerException("Iterator must not be null"); } return new ListIteratorWrapper(iterator); }
private boolean nextGroups(OuterJoinType outerJoinType) throws IOException { if (outerJoinType == OuterJoinType.FULL) { return nextGroups(); } else if (outerJoinType == OuterJoinType.LEFT) { boolean leftContainsElements = false; while (!leftContainsElements && nextGroups()) { currLeftIterator = new ListIteratorWrapper(currLeftSubset.iterator()); if (currLeftIterator.next() != null) { leftContainsElements = true; } currLeftIterator.reset(); } return leftContainsElements; } else if (outerJoinType == OuterJoinType.RIGHT) { boolean rightContainsElements = false; while (!rightContainsElements && nextGroups()) { currRightIterator = new ListIteratorWrapper(currRightSubset.iterator()); if (currRightIterator.next() != null) { rightContainsElements = true; } currRightIterator.reset(); } return rightContainsElements; } else { throw new IllegalArgumentException("Outer join of type '" + outerJoinType + "' not supported."); } }
private boolean nextGroups(OuterJoinType outerJoinType) throws IOException { if (outerJoinType == OuterJoinType.FULL) { return nextGroups(); } else if (outerJoinType == OuterJoinType.LEFT) { boolean leftContainsElements = false; while (!leftContainsElements && nextGroups()) { currLeftIterator = new ListIteratorWrapper(currLeftSubset.iterator()); if (currLeftIterator.next() != null) { leftContainsElements = true; } currLeftIterator.reset(); } return leftContainsElements; } else if (outerJoinType == OuterJoinType.RIGHT) { boolean rightContainsElements = false; while (!rightContainsElements && nextGroups()) { currRightIterator = new ListIteratorWrapper(currRightSubset.iterator()); if (currRightIterator.next() != null) { rightContainsElements = true; } currRightIterator.reset(); } return rightContainsElements; } else { throw new IllegalArgumentException("Outer join of type '" + outerJoinType + "' not supported."); } }
@SuppressWarnings("unchecked") private boolean next() throws IOException { boolean hasMoreElements; if ((currLeftIterator == null || !currLeftIterator.hasNext()) && (currRightIterator == null || !currRightIterator.hasNext())) { hasMoreElements = nextGroups(outerJoinType); if (hasMoreElements) { if (outerJoinType != OuterJoinType.LEFT) { currLeftIterator = new ListIteratorWrapper(currLeftSubset.iterator()); } leftReturn = (IN1) currLeftIterator.next(); if (outerJoinType != OuterJoinType.RIGHT) { currRightIterator = new ListIteratorWrapper(currRightSubset.iterator()); } rightReturn = (IN2) currRightIterator.next(); return true; } else { //no more elements return false; } } else if (currLeftIterator.hasNext() && !currRightIterator.hasNext()) { leftReturn = (IN1) currLeftIterator.next(); currRightIterator.reset(); rightReturn = (IN2) currRightIterator.next(); return true; } else { rightReturn = (IN2) currRightIterator.next(); return true; } }
@SuppressWarnings("unchecked") private boolean next() throws IOException { boolean hasMoreElements; if ((currLeftIterator == null || !currLeftIterator.hasNext()) && (currRightIterator == null || !currRightIterator.hasNext())) { hasMoreElements = nextGroups(outerJoinType); if (hasMoreElements) { if (outerJoinType != OuterJoinType.LEFT) { currLeftIterator = new ListIteratorWrapper(currLeftSubset.iterator()); } leftReturn = (IN1) currLeftIterator.next(); if (outerJoinType != OuterJoinType.RIGHT) { currRightIterator = new ListIteratorWrapper(currRightSubset.iterator()); } rightReturn = (IN2) currRightIterator.next(); return true; } else { //no more elements return false; } } else if (currLeftIterator.hasNext() && !currRightIterator.hasNext()) { leftReturn = (IN1) currLeftIterator.next(); currRightIterator.reset(); rightReturn = (IN2) currRightIterator.next(); return true; } else { rightReturn = (IN2) currRightIterator.next(); return true; } }