Java Array Equal equals(Map map1, Map map2)

Here you can find the source of equals(Map map1, Map map2)

Description

equals

License

Open Source License

Declaration

static boolean equals(Map<String, String[]> map1, Map<String, String[]> map2) 

Method Source Code


//package com.java2s;
/*/*from w  ww . ja va 2 s  .co m*/
 * Copyright (C) 2010 eXo Platform SAS.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */

import java.util.Arrays;

import java.util.Map;

public class Main {
    static boolean equals(Map<String, String[]> map1, Map<String, String[]> map2) {
        if (map1.keySet().equals(map2.keySet())) {
            for (Map.Entry<String, String[]> parameter : map1.entrySet()) {
                String[] thatParameterValues = map2.get(parameter.getKey());
                if (thatParameterValues != null) {
                    if (!Arrays.equals(parameter.getValue(), thatParameterValues)) {
                        return false;
                    }
                }
            }
            return true;
        }
        return false;
    }
}

Related

  1. equals(final T[][] a, final T[][] b)
  2. equals(int[] a, int[] b)
  3. equals(int[][] ar1, int[][] ar2)
  4. equals(long[] a, long[] a2)
  5. equals(Map a, Map b)
  6. equals(Object array1, Object array2)
  7. equals(Object array1, Object array2)
  8. equals(Object array1, Object array2)
  9. equals(Object[] objs1, Object[] objs2)