(Object a, Object b)
| 89 | } |
| 90 | |
| 91 | public static boolean equals(Object a, Object b) { |
| 92 | if (a == b) return true; |
| 93 | // one null, one not |
| 94 | if (a == null || b == null) return false; |
| 95 | |
| 96 | // List deep compare |
| 97 | if (a instanceof List<?> list1) { |
| 98 | if (!(b instanceof List<?> list2)) return false; |
| 99 | if (list1.size() != list2.size()) return false; |
| 100 | |
| 101 | for (int i = 0; i < list1.size(); i++) { |
| 102 | Object item1 = list1.get(i); |
| 103 | Object item2 = list2.get(i); |
| 104 | if (!equals(item1, item2)) return false; // recursive |
| 105 | } |
| 106 | return true; |
| 107 | } |
| 108 | |
| 109 | if (a instanceof Map<?, ?> map1) { |
| 110 | if (!(b instanceof Map<?, ?> map2)) return false; |
| 111 | |
| 112 | for (Map.Entry<?, ?> e : map1.entrySet()) { |
| 113 | Object key = e.getKey(); |
| 114 | if (!(key instanceof String)) { |
| 115 | return false; |
| 116 | } |
| 117 | if (!map2.containsKey(key)) return false; |
| 118 | if (!equals(e.getValue(), map2.get(key))) return false; |
| 119 | } |
| 120 | return true; |
| 121 | } |
| 122 | |
| 123 | return isEqual(a, b); |
| 124 | } |
| 125 | |
| 126 | public static Object mod(Object a, Object b) { |
| 127 | return Helpers.mod(a, b); |
no test coverage detected