mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-23 12:07:02 +08:00
Implement equality for RedableNativeArray
Summary: This diff implements equality on RedableNativeArray objects. This relies on the Arrays.deepEquals method Reviewed By: kathryngray Differential Revision: D14022108 fbshipit-source-id: 48b59529a9060a2bddba5fc8e3681c922ec31be4
This commit is contained in:
committed by
Facebook Github Bot
parent
c86f59cb82
commit
a8703fe10b
@@ -172,6 +172,20 @@ public class ReadableNativeArray extends NativeArray implements ReadableArray {
|
||||
return DynamicFromArray.create(this, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getLocalArray().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof ReadableNativeArray)) {
|
||||
return false;
|
||||
}
|
||||
ReadableNativeArray other = (ReadableNativeArray) obj;
|
||||
return Arrays.deepEquals(getLocalArray(), other.getLocalArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nonnull ArrayList<Object> toArrayList() {
|
||||
ArrayList<Object> arrayList = new ArrayList<>();
|
||||
|
||||
Reference in New Issue
Block a user