Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * Copyright (C) 2010 The Guava Authors
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.
Contains static factory methods for creating Equivalence instances.

All methods return serializable instances.

Bob Lee
Kurt Alfred Kluever
Gregory Kick
public final class Equivalences {
  private Equivalences() {}

Returns an equivalence that delegates to java.lang.Object.equals(java.lang.Object) and java.lang.Object.hashCode(). Equivalence.equivalent(java.lang.Object,java.lang.Object) returns true if both values are null, or if neither value is null and java.lang.Object.equals(java.lang.Object) returns true. Equivalence.hash(java.lang.Object) returns 0 if passed a null value.

This method has been moved to Equivalence.equals(). This method is scheduled to be removed in Guava release 14.0.
8.0 (present null-friendly behavior)
4.0 (otherwise)
  public static Equivalence<Objectequals() {
    return ..;

Returns an equivalence that uses == to compare values and java.lang.System.identityHashCode(java.lang.Object) to compute the hash code. Equivalence.equivalent(java.lang.Object,java.lang.Object) returns true if a == b, including in the case that a and b are both null.

This method has been moved to Equivalence.identity(). This method is schedule to be removed in Guava release 14.0.
  public static Equivalence<Objectidentity() {
New to GrepCode? Check out our FAQ X