Example usage for com.google.common.base Equivalence equals

List of usage examples for com.google.common.base Equivalence equals

Introduction

In this page you can find the example usage for com.google.common.base Equivalence equals.

Prototype

public static Equivalence<Object> equals() 

Source Link

Document

Returns an equivalence that delegates to Object#equals and Object#hashCode .

Usage

From source file:com.github.fge.jsonschema.core.util.equivalence.Equivalences.java

/**
 * Return a parameterized {@link Equivalence#equals()}
 *
 * @param <T> the parameter type//from  w  ww .  j a v  a  2  s  .com
 * @return the parameterized equivalence
 */
@SuppressWarnings("unchecked")
public static <T> Equivalence<T> equals() {
    return (Equivalence<T>) Equivalence.equals();
}

From source file:org.apache.marmotta.commons.collections.EquivalenceHashSet.java

public EquivalenceHashSet() {
    this.equivalence = Equivalence.equals();
    this.delegate = new HashSet<>();
}

From source file:edu.buaa.satla.analysis.core.predicate.BAMFreshValueProvider.java

@Override
public FreshValueProvider merge(final FreshValueProvider other) {
    if (other instanceof DefaultFreshValueProvider) {
        return this;
    } else if (other instanceof BAMFreshValueProvider) {
        PersistentSortedMap<String, Integer> vars = PersistentSortedMaps.merge(this.vars,
                ((BAMFreshValueProvider) other).vars, Equivalence.equals(),
                PersistentSortedMaps.<String, Integer>getMaximumMergeConflictHandler(), null);
        return new BAMFreshValueProvider(vars);
    } else {//from w w  w.  j a va2  s.c  o m
        throw new AssertionError("unhandled case for FreshValueProvider: " + other.getClass());
    }
}

From source file:com.github.ferstl.maven.pomenforcers.priority.PriorityOrdering.java

public PriorityOrdering(Collection<P> priorityCollection, Function<T, P> transformer) {
    this(priorityCollection, transformer, Equivalence.equals());
}

From source file:org.lenskit.results.Results.java

/**
 * An equivalence relation that considers objects to be equal if they are equal after being converted to
 * basic results (that is, their IDs and scores are equal).
 * @return The equivalence relation.//from  w  w w  . j av a2 s  .  c  o m
 */
public static Equivalence<Result> basicEquivalence() {
    return Equivalence.equals().onResultOf(basicCopyFunction());
}

From source file:org.gradle.plugins.ide.eclipse.model.internal.SourceFoldersCreator.java

private List<String> getIncludesForTree(SourceSet sourceSet, DirectoryTree directoryTree) {
    List<Set<String>> includesByType = getFiltersForTreeGroupedByType(sourceSet, directoryTree, "includes");
    for (Set<String> it : includesByType) {
        if (it.isEmpty()) {
            return Collections.emptyList();
        }/*from  w w w . j  a v  a  2  s  .c o m*/
    }

    List<String> allIncludes = CollectionUtils.flattenCollections(String.class, includesByType);
    return CollectionUtils.dedup(allIncludes, Equivalence.equals());
}

From source file:org.sosy_lab.cpachecker.util.predicates.pathformula.SSAMap.java

/**
 * Creates an unmodifiable SSAMap that contains all indices from two SSAMaps.
 * If there are conflicting indices, the maximum of both is used.
 * Further returns a list with all variables for which different indices
 * were found, together with the two conflicting indices.
 *//*w  w  w.j  a  v a2 s  .c  o  m*/
public static Pair<SSAMap, List<Triple<String, Integer, Integer>>> merge(SSAMap s1, SSAMap s2) {
    // This method uses some optimizations to avoid work when parts of both SSAMaps
    // are equal. These checks use == instead of equals() because it is much faster
    // and we create sets lazily (so when they are not identical, they are
    // probably not equal, too).
    // We don't bother checking the vars set for emptiness, because this will
    // probably never be the case on a merge.

    PersistentSortedMap<String, Integer> vars;
    FreshValueProvider freshValueProvider;
    List<Triple<String, Integer, Integer>> differences;
    if (s1.vars == s2.vars && s1.freshValueProvider == s2.freshValueProvider) {
        differences = ImmutableList.of();
        // both are absolutely identical
        return Pair.of(s1, differences);

    } else {
        differences = new ArrayList<>();
        vars = PersistentSortedMaps.merge(s1.vars, s2.vars, Equivalence.equals(),
                PersistentSortedMaps.<String, Integer>getMaximumMergeConflictHandler(), differences);
        freshValueProvider = s1.freshValueProvider.merge(s2.freshValueProvider);
    }

    PersistentSortedMap<String, CType> varTypes = PersistentSortedMaps.merge(s1.varTypes, s2.varTypes,
            CTypes.canonicalTypeEquivalence(), TYPE_CONFLICT_CHECKER, null);

    return Pair.of(new SSAMap(vars, freshValueProvider, 0, varTypes), differences);
}