org.apache.ode.utils

## Class CollectionUtils

- java.lang.Object
- - org.apache.ode.utils.CollectionUtils

-     public class CollectionUtils
      extends java.lang.Object

  Utility class for dealing with arrays.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.Class[]` | `EMPTY_CLASS_ARRAY`
    `static java.lang.Object[]` | `EMPTY_OBJECT_ARRAY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CollectionUtils()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `equals(java.util.Map m1, java.util.Map m2)` Compares the two specified maps for equality.
    `static <T> java.util.Collection<T>` | `makeCollection(java.lang.Class<? extends java.util.Collection> type, T[] elements)` Make a `Collection` out of an array.

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

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

- - ### Field Detail

    - #### EMPTY_OBJECT_ARRAY

          public static final java.lang.Object[] EMPTY_OBJECT_ARRAY

    - #### EMPTY_CLASS_ARRAY

          public static final java.lang.Class[] EMPTY_CLASS_ARRAY

  - ### Constructor Detail

    - #### CollectionUtils

          public CollectionUtils()

  - ### Method Detail

    - #### makeCollection

          public static <T> java.util.Collection<T> makeCollection(java.lang.Class<? extends java.util.Collection> type,
                                                                   T[] elements)

      Make a `Collection` out of an array.
      Parameters:
        `type` - the type of `Collection` to make.
        `elements` - objects to put into the collection.
      Returns:
        a `Collection` of the type given in the `type argument containing `elements``

    - #### equals

          public static boolean equals(java.util.Map m1,
                                       java.util.Map m2)

      Compares the two specified maps for equality. Returns `true` if the two maps represent the same mappings. More formally, two maps `m1` and `m2` represent the same mappings if `m1.keySet().equals(m2.keySet())` and for every key `k` in `m1.keySet()`, `(m1.get(k)==null ? m2.get(k)==null : m1.get(k).equals(m2.get(k)))` .

      This implementation first checks if the `m1` and `m2` are the same object; if so it returns `true`. Then, it checks if the two maps have the same sizw; if not, it returns `false`. If so, it iterates over `m1`'s `entrySet` collection, and checks that map `m1` contains each mapping that map `m2` contains. If map `m1` fails to contain such a mapping, `false` is returned. If the iteration completes, `true` is returned.
      Returns:
        `true` if the specified object is equal to this map.