Module org.htmlunit

Class ArrayUtils

java.lang.Object
org.htmlunit.util.ArrayUtils

public final class ArrayUtils extends Object
Utility functions not covered by third-party libraries.
Author:
Ronald Brill
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final byte[]
    An empty immutable byte array.
    static final char[]
    An empty immutable char array.
    static final String[]
    An empty immutable String array.
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    contains(byte[] bytes, byte expected)
    Returns whether at least one element of the given array equals the expected byte.
    static boolean
    contains(char[] chars, char expected)
    Returns whether at least one element of the given array equals the expected char.
    static boolean
    contains(String[] strings, String expected)
    Returns whether at least one element of the given array equals the expected string.
    static boolean
    containsIgnoreCase(String[] strings, String expected)
    Returns whether at least one element of the given array equals the expected string, ignoring case.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • EMPTY_BYTE_ARRAY

      public static final byte[] EMPTY_BYTE_ARRAY
      An empty immutable byte array.
    • EMPTY_CHAR_ARRAY

      public static final char[] EMPTY_CHAR_ARRAY
      An empty immutable char array.
    • EMPTY_STRING_ARRAY

      public static final String[] EMPTY_STRING_ARRAY
      An empty immutable String array.
  • Method Details

    • contains

      public static boolean contains(String[] strings, String expected)
      Returns whether at least one element of the given array equals the expected string.
      Parameters:
      strings - the string array to check
      expected - the string to search for
      Returns:
      true if at least one element equals the expected string
    • contains

      public static boolean contains(char[] chars, char expected)
      Returns whether at least one element of the given array equals the expected char.
      Parameters:
      chars - the char array to check
      expected - the char to search for
      Returns:
      true if at least one element equals the expected char
    • contains

      public static boolean contains(byte[] bytes, byte expected)
      Returns whether at least one element of the given array equals the expected byte.
      Parameters:
      bytes - the byte array to check
      expected - the byte to search for
      Returns:
      true if at least one element equals the expected byte
    • containsIgnoreCase

      public static boolean containsIgnoreCase(String[] strings, String expected)
      Returns whether at least one element of the given array equals the expected string, ignoring case.
      Parameters:
      strings - the string array to check
      expected - the string to search for
      Returns:
      true if at least one element equals the expected string, ignoring case