Package jodd.util

Class CollectionUtil


  • public class CollectionUtil
    extends java.lang.Object
    Some collection utilities.
    • Constructor Summary

      Constructors 
      Constructor Description
      CollectionUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <E> java.util.Enumeration<E> asEnumeration​(java.util.Iterator<E> iter)
      Adapt the specified Iterator to the Enumeration interface.
      static <E> java.util.Iterator<E> asIterator​(java.util.Enumeration<E> e)
      Adapt the specified Enumeration to the Iterator interface.
      static <T> java.util.Collection<T> collectionOf​(java.util.Iterator<? extends T> iterator)
      Returns a collection containing all elements of the iterator.
      static <T> java.util.stream.Stream<T> parallelStreamOf​(java.lang.Iterable<T> iterable)
      Wraps an iterator as a stream.
      static <T> java.util.stream.Stream<T> parallelStreamOf​(java.util.Iterator<T> iterator)
      Wraps an iterator as a stream.
      static <T> java.util.stream.Stream<T> streamOf​(java.lang.Iterable<T> iterable)
      Converts interable to a non-parallel stream.
      static <T> java.util.stream.Stream<T> streamOf​(java.util.Iterator<T> iterator)
      Converts iterator to a stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CollectionUtil

        public CollectionUtil()
    • Method Detail

      • asEnumeration

        public static <E> java.util.Enumeration<E> asEnumeration​(java.util.Iterator<E> iter)
        Adapt the specified Iterator to the Enumeration interface.
      • asIterator

        public static <E> java.util.Iterator<E> asIterator​(java.util.Enumeration<E> e)
        Adapt the specified Enumeration to the Iterator interface.
      • collectionOf

        public static <T> java.util.Collection<T> collectionOf​(java.util.Iterator<? extends T> iterator)
        Returns a collection containing all elements of the iterator.
      • streamOf

        public static <T> java.util.stream.Stream<T> streamOf​(java.util.Iterator<T> iterator)
        Converts iterator to a stream.
      • streamOf

        public static <T> java.util.stream.Stream<T> streamOf​(java.lang.Iterable<T> iterable)
        Converts interable to a non-parallel stream.
      • parallelStreamOf

        public static <T> java.util.stream.Stream<T> parallelStreamOf​(java.util.Iterator<T> iterator)
        Wraps an iterator as a stream.
      • parallelStreamOf

        public static <T> java.util.stream.Stream<T> parallelStreamOf​(java.lang.Iterable<T> iterable)
        Wraps an iterator as a stream.