You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/12/14 12:59:02 UTC

[GitHub] [ignite] alex-plekhanov commented on a change in pull request #9641: IGNITE-12578 Fix IgniteCache#replace for arrays

alex-plekhanov commented on a change in pull request #9641:
URL: https://github.com/apache/ignite/pull/9641#discussion_r768637022



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryPredicateContainsValue.java
##########
@@ -73,6 +74,27 @@ public CacheEntryPredicateContainsValue(CacheObject val) {
         Object thisVal = CU.value(this.val, cctx, false);
         Object cacheVal = CU.value(val, cctx, false);
 
+        if (thisVal.getClass().isArray()) {
+            if (thisVal instanceof Object[])
+                return cacheVal instanceof Object[] && Arrays.deepEquals((Object[])thisVal, (Object[])cacheVal);
+            else if (thisVal instanceof byte[])
+                return cacheVal instanceof byte[] && Arrays.equals((byte[])thisVal, (byte[])cacheVal);
+            else if (thisVal instanceof short[])
+                return cacheVal instanceof short[] && Arrays.equals((short[])thisVal, (short[])cacheVal);
+            else if (thisVal instanceof int[])
+                return cacheVal instanceof int[] && Arrays.equals((int[])thisVal, (int[])cacheVal);
+            else if (thisVal instanceof long[])
+                return cacheVal instanceof long[] && Arrays.equals((long[])thisVal, (long[])cacheVal);
+            else if (thisVal instanceof float[])
+                return cacheVal instanceof float[] && Arrays.equals((float[])thisVal, (float[])cacheVal);
+            else if (thisVal instanceof double[])
+                return cacheVal instanceof double[] && Arrays.equals((double[])thisVal, (double[])cacheVal);
+            else if (thisVal instanceof boolean[])
+                return cacheVal instanceof boolean[] && Arrays.equals((boolean[])thisVal, (boolean[])cacheVal);
+            else if (thisVal instanceof char[])
+                return cacheVal instanceof char[] && Arrays.equals((char[])thisVal, (char[])cacheVal);
+        }
+

Review comment:
       `Objects.deepEquals()` ?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org