Module openj9.dtfj

Class IteratorHelpers


  • public class IteratorHelpers
    extends Object
    Utility functions for working with iterators
    • Constructor Detail

      • IteratorHelpers

        public IteratorHelpers()
    • Method Detail

      • combineIterators

        public static <T> Iterator<T> combineIterators​(Iterator<T>... iterators)
        Takes a list of iterators and returns one iterator that iterates over each iterator in turn.
      • toList

        public static <T> List<T> toList​(Iterator<T> it)
      • filterIterator

        public static <T> Iterator<T> filterIterator​(Iterator<T> it,
                                                     IteratorHelpers.IteratorFilter<T> filter)
        Filters an iterator
        Type Parameters:
        T - Generic type of iterator
        Parameters:
        it - Iterator to be filtered
        filter - Filter object to select which objects to be passed through
        Returns:
        Filtered iterator