Class ArrayInspection

java.lang.Object
org.fest.assertions.ArrayInspection

public final class ArrayInspection extends Object
Understands utility methods for arrays.
Since:
1.2
  • Constructor Details

    • ArrayInspection

      private ArrayInspection()
  • Method Details

    • copy

      public static Object[] copy(Object array)
      Copies the contents of the given array into an array of objects.
      Parameters:
      array - the array to copy.
      Returns:
      an array of objects containing the contents of the array.
      Throws:
      IllegalArgumentException - if the given object is not an array.
    • toList

      public static List<Object> toList(Object array)
      Copies the contents of the given array into a list.
      Parameters:
      array - the array to copy.
      Returns:
      a list containing the contents of the array.
      Throws:
      IllegalArgumentException - if the given object is not an array.
      Since:
      1.3.
    • toSet

      public static Set<Object> toSet(Object array)
      Copies the contents of the given array into a list.
      Parameters:
      array - the array to copy.
      Returns:
      a list containing the contents of the array.
      Throws:
      IllegalArgumentException - if the given object is not an array.
      Since:
      1.3.
    • copy

      private static <T extends Collection<Object>> T copy(Object array, T destination)
    • sizeOf

      public static int sizeOf(Object array)
      Returns the size of the given array.
      Parameters:
      array - the array.
      Returns:
      the size of the given array.
      Throws:
      NullPointerException - if the given array is null.
      IllegalArgumentException - if the given object is not an array.
    • validateIsArray

      private static void validateIsArray(Object array)