org.apache.struts2.util

## Class ContainUtil

- java.lang.Object
- - org.apache.struts2.util.ContainUtil

-     public class ContainUtil
      extends Object

  `ContainUtil` will check if object 1 contains object 2. Object 1 may be an Object, array, Collection, or a Map

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ContainUtil()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `contains(Object obj1, Object obj2)` Determine if `obj2` exists in `obj1`.

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

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

- - ### Constructor Detail

    - #### ContainUtil

          public ContainUtil()

  - ### Method Detail

    - #### contains

          public static boolean contains(Object obj1,
                                         Object obj2)

      Determine if `obj2` exists in `obj1`.

      Type Of obj1 | Comparison type
      null |  | always return false
      Map | Map containsKey(obj2)
      Collection | Collection contains(obj2)
      Array | there's an array element (e) where e.equals(obj2)
      Object | obj1.equals(obj2)

      Parameters:
        `obj1` - first object
        `obj2` - second object
      Returns:
        true if first object contains second object or if the are equals, otherwise false

Copyright © 2000–2025 Apache Software Foundation. All rights reserved.