Class ArrayUtil

java.lang.Object
de.eldoria.eldoutilities.utils.ArrayUtil

public final class ArrayUtil extends Object
This class containts methods to handle arrays and search.
Since:
1.0.0
  • Method Details

    • findInArray

      public static Matcher findInArray(String[] strings, Pattern contains)
      Checks if a string in a array matches a pattern.
      Parameters:
      strings - strings to check
      contains - pattern to check against
      Returns:
      matcher instance wich matches the string
    • arrayContains

      public static boolean arrayContains(String[] strings, String... values)
      Checks if a array contains any of the values.
      Parameters:
      strings - string to check
      values - one or more value to check agains
      Returns:
      true if a match was found
    • arrayContains

      public static boolean arrayContains(char[] chars, char... values)
      Checks if a array contains any of the values.
      Parameters:
      chars - chars to check
      values - one or more value to check agains
      Returns:
      true if a match was found
    • combineArrays

      public static String[] combineArrays(String[] array, String[]... arrays)
      Combines two or more arrays.
      Parameters:
      array - array to combine
      arrays - arrays to combine
      Returns:
      one array
    • combineArrays

      @SafeVarargs public static <T> T[] combineArrays(Class<T> clazz, T[] array, T[]... arrays)
      Combines two or more arrays.
      Type Parameters:
      T - type of array
      Parameters:
      array - array to combine
      arrays - arrays to combine
      clazz - clazz of array
      Returns:
      one array
    • startingWithInArray

      public static Stream<String> startingWithInArray(String value, String[] array)
      Searches for strings, which are starting with the provided value
      Parameters:
      value - start to search for
      array - array to check
      Returns:
      list of strings which starts with the provided value
    • stringStartingWithValueInArray

      public static boolean stringStartingWithValueInArray(String value, String[] array)
      Checks if a string start with any value in a string.
      Parameters:
      value - value to check
      array - array values.
      Returns:
      true if the value starts with any value in the array
    • endingWithInArray

      public static boolean endingWithInArray(String value, String[] array)
      Checks if a string ends with a value in a array
      Parameters:
      value - value to check
      array - array values.
      Returns:
      true if the value ends with any value in the array