Class IterationLogger


  • public final class IterationLogger
    extends java.lang.Object
    An utility class that allows automatic logging while iterating over elements of a collection, stream or array.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <E> java.lang.Iterable<E> iterate​(org.apache.logging.log4j.Logger logger, E[] array, java.lang.String message, java.lang.String objects)
      Wraps the given array into an Iterable instance that automatically logs at level Level.INFO while traversing the array.
      static <E> java.lang.Iterable<E> iterate​(org.apache.logging.log4j.Logger logger, java.lang.Iterable<E> iterable, java.lang.String message, java.lang.String objects)
      Wraps the given iterable into an Iterable instance that automatically logs at level Level.INFO while traversing the array.
      static <E> java.lang.Iterable<E> iterate​(org.apache.logging.log4j.Logger logger, java.util.Collection<E> collection, java.lang.String message, java.lang.String objects)
      Wraps the given collection into an Iterable instance that automatically logs at level Level.INFO while traversing the collection.
      static <E> java.lang.Iterable<E> iterate​(org.apache.logging.log4j.Logger logger, java.util.stream.Stream<E> stream, java.lang.String message, java.lang.String objects)
      Wraps the given stream into an Iterable instance that automatically logs at level Level.INFO while traversing a collection created from the stream.
      static <E> java.lang.Iterable<E> iterate​(org.apache.logging.log4j.Logger logger, org.apache.logging.log4j.Level level, E[] array, java.lang.String message, java.lang.String objects)
      Wraps the given array into an Iterable instance that automatically logs while traversing the array.
      static <E> java.lang.Iterable<E> iterate​(org.apache.logging.log4j.Logger logger, org.apache.logging.log4j.Level level, java.lang.Iterable<E> iterable, java.lang.String message, java.lang.String objects)
      Wraps the given iterable into an Iterable instance that automatically logs while traversing the iterable.
      static <E> java.lang.Iterable<E> iterate​(org.apache.logging.log4j.Logger logger, org.apache.logging.log4j.Level level, java.util.Collection<E> collection, java.lang.String message, java.lang.String objects)
      Wraps the given collection into an Iterable instance that automatically logs while traversing the collection.
      static <E> java.lang.Iterable<E> iterate​(org.apache.logging.log4j.Logger logger, org.apache.logging.log4j.Level level, java.util.stream.Stream<E> stream, java.lang.String message, java.lang.String objects)
      Wraps the given array into an Iterable instance that automatically logs while traversing a collection created from the stream.
      • Methods inherited from class java.lang.Object

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

      • iterate

        public static <E> java.lang.Iterable<E> iterate​(org.apache.logging.log4j.Logger logger,
                                                        E[] array,
                                                        java.lang.String message,
                                                        java.lang.String objects)
        Wraps the given array into an Iterable instance that automatically logs at level Level.INFO while traversing the array.
        Type Parameters:
        E - the type of elements in the array
        Parameters:
        logger - the logger to log onto
        array - the array to be iterated over
        message - the message to display at each update
        objects - the objects being counted
        Returns:
        an iterable that automatically logs while traversing the array
      • iterate

        public static <E> java.lang.Iterable<E> iterate​(org.apache.logging.log4j.Logger logger,
                                                        org.apache.logging.log4j.Level level,
                                                        E[] array,
                                                        java.lang.String message,
                                                        java.lang.String objects)
        Wraps the given array into an Iterable instance that automatically logs while traversing the array.
        Type Parameters:
        E - the type of elements in the array
        Parameters:
        logger - the logger to log onto
        level - the Level to log to
        array - the array to be iterated over
        message - the message to display at each update
        objects - the objects being counted
        Returns:
        an iterable that automatically logs while traversing the array
      • iterate

        public static <E> java.lang.Iterable<E> iterate​(org.apache.logging.log4j.Logger logger,
                                                        java.util.Collection<E> collection,
                                                        java.lang.String message,
                                                        java.lang.String objects)
        Wraps the given collection into an Iterable instance that automatically logs at level Level.INFO while traversing the collection.
        Type Parameters:
        E - the type of elements in the collection
        Parameters:
        logger - the logger to log onto
        collection - the collection to be iterated over
        message - the message to display at each update
        objects - the objects being counted
        Returns:
        an iterable that automatically logs while traversing the collection
      • iterate

        public static <E> java.lang.Iterable<E> iterate​(org.apache.logging.log4j.Logger logger,
                                                        org.apache.logging.log4j.Level level,
                                                        java.util.Collection<E> collection,
                                                        java.lang.String message,
                                                        java.lang.String objects)
        Wraps the given collection into an Iterable instance that automatically logs while traversing the collection.
        Type Parameters:
        E - the type of elements in the collection
        Parameters:
        logger - the logger to log onto
        level - the Level to log to
        collection - the collection to be iterated over
        message - the message to display at each update
        objects - the objects being counted
        Returns:
        an iterable that automatically logs while traversing the collection
      • iterate

        public static <E> java.lang.Iterable<E> iterate​(org.apache.logging.log4j.Logger logger,
                                                        java.lang.Iterable<E> iterable,
                                                        java.lang.String message,
                                                        java.lang.String objects)
        Wraps the given iterable into an Iterable instance that automatically logs at level Level.INFO while traversing the array.
        Type Parameters:
        E - the type of elements in the iterable
        Parameters:
        logger - the logger to log onto
        iterable - the iterable to be iterated over
        message - the message to display at each update
        objects - the objects being counted
        Returns:
        an iterable that automatically logs while traversing the iterable
      • iterate

        public static <E> java.lang.Iterable<E> iterate​(org.apache.logging.log4j.Logger logger,
                                                        org.apache.logging.log4j.Level level,
                                                        java.lang.Iterable<E> iterable,
                                                        java.lang.String message,
                                                        java.lang.String objects)
        Wraps the given iterable into an Iterable instance that automatically logs while traversing the iterable.
        Type Parameters:
        E - the type of elements in the iterable
        Parameters:
        logger - the logger to log onto
        level - the Level to log to
        iterable - the iterable to be iterated over
        message - the message to display at each update
        objects - the objects being counted
        Returns:
        an iterable that automatically logs while traversing the iterable
      • iterate

        public static <E> java.lang.Iterable<E> iterate​(org.apache.logging.log4j.Logger logger,
                                                        java.util.stream.Stream<E> stream,
                                                        java.lang.String message,
                                                        java.lang.String objects)
        Wraps the given stream into an Iterable instance that automatically logs at level Level.INFO while traversing a collection created from the stream.
        Type Parameters:
        E - the type of elements in the stream
        Parameters:
        logger - the logger to log onto
        stream - the stream to be iterated over
        message - the message to display at each update
        objects - the objects being counted
        Returns:
        an iterable that automatically logs while traversing the collection created from the stream
      • iterate

        public static <E> java.lang.Iterable<E> iterate​(org.apache.logging.log4j.Logger logger,
                                                        org.apache.logging.log4j.Level level,
                                                        java.util.stream.Stream<E> stream,
                                                        java.lang.String message,
                                                        java.lang.String objects)
        Wraps the given array into an Iterable instance that automatically logs while traversing a collection created from the stream.
        Type Parameters:
        E - the type of elements in the stream
        Parameters:
        logger - the logger to log onto
        level - the Level to log to
        stream - the array to be iterated over
        message - the message to display at each update
        objects - the objects being counted
        Returns:
        an iterable that automatically logs while traversing the collection created from the stream