org.apache.hc.core5.util

## Class LangUtils

- java.lang.Object
- - org.apache.hc.core5.util.LangUtils

-     public final class LangUtils
      extends Object

  A set of utility methods to help produce consistent `equals` and `hashCode` methods.
  Since:
    4.0

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `HASH_OFFSET`
    `static int` | `HASH_SEED`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `equals(Object[] a1, Object[] a2)` Check if two object arrays are equal.
    `static boolean` | `equals(Object obj1, Object obj2)` Check if two objects are equal.
    `static int` | `hashCode(int seed, boolean b)`
    `static int` | `hashCode(int seed, int hashcode)`
    `static int` | `hashCode(int seed, Object obj)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### HASH_SEED

          public static final int HASH_SEED

      See Also:
        Constant Field Values

    - #### HASH_OFFSET

          public static final int HASH_OFFSET

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### hashCode

          public static int hashCode(int seed,
                                     int hashcode)

    - #### hashCode

          public static int hashCode(int seed,
                                     boolean b)

    - #### hashCode

          public static int hashCode(int seed,
                                     Object obj)

    - #### equals

          public static boolean equals(Object obj1,
                                       Object obj2)

      Check if two objects are equal.
      Parameters:
        `obj1` - first object to compare, may be `null`
        `obj2` - second object to compare, may be `null`
      Returns:
        `true` if the objects are equal or both null

    - #### equals

          public static boolean equals(Object[] a1,
                                       Object[] a2)

      Check if two object arrays are equal.
      - If both parameters are null, return `true`
      - If one parameter is null, return `false`
      - If the array lengths are different, return `false`
      - Compare array elements using .equals(); return `false` if any comparisons fail.
      - Return `true`
      Parameters:
        `a1` - first array to compare, may be `null`
        `a2` - second array to compare, may be `null`
      Returns:
        `true` if the arrays are equal or both null

Copyright © 2005–2022 The Apache Software Foundation. All rights reserved.