Example usage for java.util Objects deepEquals

List of usage examples for java.util Objects deepEquals

Introduction

In this page you can find the example usage for java.util Objects deepEquals.

Prototype

public static boolean deepEquals(Object a, Object b) 

Source Link

Document

Returns true if the arguments are deeply equal to each other and false otherwise.

Usage

From source file:Main.java

/**
 * Check whether two {@link Map} equal./*ww w.  j  a va  2 s . c  o m*/
 */
static <T> boolean equals(Map<T, byte[]> map, Map<T, byte[]> otherMap) {
    if (map == otherMap) {
        return true;
    }
    if (map == null || otherMap == null) {
        return false;
    }
    if (map.size() != otherMap.size()) {
        return false;
    }
    Set<T> keys = map.keySet();
    if (!keys.equals(otherMap.keySet())) {
        return false;
    }
    for (T key : keys) {
        if (!Objects.deepEquals(map.get(key), otherMap.get(key))) {
            return false;
        }
    }
    return true;
}

From source file:Main.java

/**
 * Check whether two {@link Map} equal./*from   w  w  w  .j a v a2s .co  m*/
 */
public static <T> boolean equals(Map<T, byte[]> map, Map<T, byte[]> otherMap) {
    if (map == otherMap) {
        return true;
    }
    if (map == null || otherMap == null) {
        return false;
    }
    if (map.size() != otherMap.size()) {
        return false;
    }
    Set<T> keys = map.keySet();
    if (!keys.equals(otherMap.keySet())) {
        return false;
    }
    for (T key : keys) {
        if (!Objects.deepEquals(map.get(key), otherMap.get(key))) {
            return false;
        }
    }
    return true;
}

From source file:com.mcleodmoores.mvn.natives.StaticLib.java

@Override
/* package */boolean equalsImpl(final Object o) {
    if (!super.equalsImpl(o))
        return false;
    final StaticLib other = (StaticLib) o;
    return Objects.deepEquals(getHeaders(), other.getHeaders());
}

From source file:com.qwazr.externalizor.AbstractCollection.java

@Override
public boolean equals(Object o) {
    if (o == null || !(o instanceof AbstractCollection))
        return false;
    final AbstractCollection c = (AbstractCollection) o;
    return Objects.deepEquals(abstractMap, c.abstractMap) && Objects.deepEquals(abstractSet, c.abstractSet)
            && Objects.deepEquals(abstractList, c.abstractList);
}

From source file:com.mcleodmoores.mvn.natives.DynamicLib.java

@Override
/* package */boolean equalsImpl(final Object o) {
    if (!super.equalsImpl(o))
        return false;
    final DynamicLib other = (DynamicLib) o;
    return Objects.deepEquals(getHeaders(), other.getHeaders())
            && Objects.deepEquals(getImplibs(), other.getImplibs());
}

From source file:com.mcleodmoores.mvn.natives.Executable.java

@Override
/* package */boolean equalsImpl(final Object o) {
    if (!super.equalsImpl(o))
        return false;
    final Executable other = (Executable) o;
    return Objects.deepEquals(getHeaders(), other.getHeaders())
            && Objects.deepEquals(getLibraries(), other.getLibraries());
}

From source file:com.qwazr.externalizor.SimpleCollection.java

@Override
public boolean equals(Object o) {

    if (o == null || !(o instanceof SimpleCollection))
        return false;
    final SimpleCollection s = (SimpleCollection) o;

    if (nullList != s.nullList)
        return false;
    if (!Objects.deepEquals(stringList, stringList))
        return false;

    if (nullSet != s.nullSet)
        return false;
    if (!Objects.deepEquals(integerSet, integerSet))
        return false;

    if (!Objects.deepEquals(byteList, byteList))
        return false;

    if (nullMap != s.nullMap)
        return false;
    if (!Objects.deepEquals(mapShortLong, mapShortLong))
        return false;

    return true;//from w ww . j ava 2 s . c  o m
}

From source file:net.sourceforge.pmd.lang.apex.ast.ApexQualifiedName.java

@Override
public boolean equals(Object obj) {
    return obj instanceof ApexQualifiedName && Objects.deepEquals(classes, ((ApexQualifiedName) obj).classes)
            && Objects.equals(operation, ((ApexQualifiedName) obj).operation)
            && Objects.equals(nameSpace, ((ApexQualifiedName) obj).nameSpace);

}

From source file:com.qwazr.externalizor.ComplexExample.java

@Override
public boolean equals(Object o) {
    if (o == null || !(o instanceof ComplexExample))
        return false;

    final ComplexExample s = (ComplexExample) o;

    if (nullObject != s.nullObject)
        return false;

    if (!Objects.equals(collection, s.collection))
        return false;

    if (!Objects.equals(abstractCollection, s.abstractCollection))
        return false;

    if (!Objects.deepEquals(mapObject, s.mapObject))
        return false;

    if (!Objects.equals(noEmptyConstructor, s.noEmptyConstructor))
        return false;
    if (!Objects.equals(noEmptyConstructorNull, s.noEmptyConstructorNull))
        return false;

    if (!Objects.equals(timeObject, s.timeObject))
        return false;

    return super.equals(o);
}

From source file:org.gradoop.flink.algorithms.fsm.dimspan.tuples.PatternEmbeddingsMap.java

/**
 * Find index of a given pattern/*from w w  w  . j a v a 2s.c o  m*/
 *
 * @param  patternMux search pattern
 *
 * @return index if contained, -1 otherwise
 */
public int getIndex(int[] patternMux) {
    int index = -1;
    int i = 0;
    for (int[] mux : getKeys()) {
        if (Objects.deepEquals(mux, patternMux)) {
            index = i;
            break;
        }
        i++;
    }

    return index;
}