mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Implement equality for ReadableNativeMap
Summary: This diff implements equality for ReadableNativeMap, the underlying implementation relies on the method HashMap.equals() Reviewed By: kathryngray Differential Revision: D14019065 fbshipit-source-id: aeaec22ce1066241ed85f0527f5cd804e3c763dd
This commit is contained in:
committed by
Facebook Github Bot
parent
a8703fe10b
commit
f4536422d6
@@ -236,6 +236,20 @@ public class ReadableNativeMap extends NativeMap implements ReadableMap {
|
||||
return new ReadableNativeMapKeySetIterator(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getLocalMap().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof ReadableNativeMap)) {
|
||||
return false;
|
||||
}
|
||||
ReadableNativeMap other = (ReadableNativeMap) obj;
|
||||
return getLocalMap().equals(other.getLocalMap());
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nonnull HashMap<String, Object> toHashMap() {
|
||||
if (ReactFeatureFlags.useMapNativeAccessor) {
|
||||
|
||||
Reference in New Issue
Block a user