public static EqualsPredicate fromMap(Map<String, Object> map) {
    Object data = (map == null) ? null : map.get(NAME);

    if (data == null) {
      throw new IllegalArgumentException("Missing data for '" + NAME + "' operation");
    } else if (data instanceof Collection) {
      Collection<?> collection = (Collection) data;
      if (collection.size() == 2) {
        Iterator<?> iterator = collection.iterator();
        Object d1 = iterator.next();
        Object d2 = iterator.next();

        if ((d1 instanceof String) && (d2 instanceof String)) {
          return new EqualsPredicate(new ContextTransformer((String) d1), (String) d2);
        } else {
          throw new IllegalArgumentException(String.format("Unexpected data types: %s and %s", d1.getClass().getName(), d2.getClass().getName()));
        }
      } else {
        throw new IllegalArgumentException(String.format("Missing data for '" + NAME + "' operation - 2 predicates are needed, %d found", collection.size()));
      }
    } else {
      throw new IllegalArgumentException(String.format("Unexpected data type for '" + NAME + "' operation - %s", data.getClass().getName()));
    }
  }
Creates a new {@link EqualsPredicate} using the given {@link Map} of data.
<p>
It is expected that the map contains a single {@link java.util.Map.Entry} where the key name
is "equals" and the value is a {@link Collection} of 2 {@link String}s. The first value
should be the key to use when retrieving data from the context, which should resolve to a
{@link String} (or null). The second value should be the value to use when checking for equality.

@return a new {@link EqualsPredicate}
ambari-server/src/main/java/org/apache/ambari/server/collections/functors/EqualsPredicate.java