Deprecate Util.areEqual
in favour of Objects.equals
`Objects.equals` has been available since API 19. PiperOrigin-RevId: 644026884
This commit is contained in:
parent
ed07ac5d7d
commit
d0815d3f7b
@ -102,6 +102,7 @@ import com.google.common.util.concurrent.Futures;
|
|||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
import com.google.common.util.concurrent.MoreExecutors;
|
import com.google.common.util.concurrent.MoreExecutors;
|
||||||
import com.google.common.util.concurrent.SettableFuture;
|
import com.google.common.util.concurrent.SettableFuture;
|
||||||
|
import com.google.errorprone.annotations.InlineMe;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -475,16 +476,15 @@ public final class Util {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests two objects for {@link Object#equals(Object)} equality, handling the case where one or
|
* @deprecated Use {@link Objects#equals(Object, Object)} instead.
|
||||||
* both may be {@code null}.
|
|
||||||
*
|
|
||||||
* @param o1 The first object.
|
|
||||||
* @param o2 The second object.
|
|
||||||
* @return {@code o1 == null ? o2 == null : o1.equals(o2)}.
|
|
||||||
*/
|
*/
|
||||||
@UnstableApi
|
@UnstableApi
|
||||||
|
@Deprecated
|
||||||
|
@InlineMe(
|
||||||
|
replacement = "Objects.equals(o1, o2)",
|
||||||
|
imports = {"java.util.Objects"})
|
||||||
public static boolean areEqual(@Nullable Object o1, @Nullable Object o2) {
|
public static boolean areEqual(@Nullable Object o1, @Nullable Object o2) {
|
||||||
return o1 == null ? o2 == null : o1.equals(o2);
|
return Objects.equals(o1, o2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user