Class IterableUtils

  • All Implemented Interfaces:
    Utils

    public abstract class IterableUtils
    extends java.lang.Object
    implements Utils
    The utility class for Iterable
    Since:
    1.0.0
    Author:
    Mercy
    See Also:
    Iterable
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean isIterable​(java.lang.Class<?> clazz)
      Checks if the given class is assignable from Iterable.
      static boolean isIterable​(java.lang.Object object)
      Checks if the given object is an instance of Iterable.
      • Methods inherited from class java.lang.Object

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

      • isIterable

        public static boolean isIterable​(@Nullable
                                         java.lang.Object object)
        Checks if the given object is an instance of Iterable.

        Example Usage

        
         List<String> list = Arrays.asList("a", "b", "c");
         boolean result1 = IterableUtils.isIterable(list);     // true
         boolean result2 = IterableUtils.isIterable("string"); // false
         boolean result3 = IterableUtils.isIterable(null);     // false
         
        Parameters:
        object - the object to check
        Returns:
        true if the object is an instance of Iterable, false otherwise
      • isIterable

        public static boolean isIterable​(@Nullable
                                         java.lang.Class<?> clazz)
        Checks if the given class is assignable from Iterable.

        Example Usage

        
         boolean result1 = IterableUtils.isIterable(List.class);  // true
         boolean result2 = IterableUtils.isIterable(String.class); // false
         boolean result3 = IterableUtils.isIterable(null);        // false
         
        Parameters:
        clazz - the class to check
        Returns:
        true if the class is assignable from Iterable, false otherwise
        See Also:
        ClassUtils.isAssignableFrom(Class, Class)