@Test public void testByteArrayListEquals() throws Exception { List<byte[]> byteArryList1 = Arrays.asList( new byte[] {1,2,3}, new byte[] {4,5,6} ); List<byte[]> byteArrayList2 = new ArrayList<>(); byteArrayList2.addAll(byteArryList1); Assert.assertTrue(ParsecEqualsUtil.byteArrayListEquals(byteArryList1, byteArrayList2)); byteArrayList2.add(new byte[] {7,8,9}); Assert.assertFalse(ParsecEqualsUtil.byteArrayListEquals(byteArryList1, byteArrayList2)); byteArrayList2.remove(1); Assert.assertFalse(ParsecEqualsUtil.byteArrayListEquals(byteArryList1, byteArrayList2)); }
static boolean byteArrayListEquals(final List<byte[]> lhs, final List<byte[]> rhs) { if (lhs != rhs) { if (lhs == null || rhs == null || lhs.size() != rhs.size()) { return false; } for (int i = 0; i < lhs.size(); i++) { if (!Arrays.equals(lhs.get(i), rhs.get(i))) { return false; } } } return true; }
ParsecEqualsUtil { static boolean byteArrayListEquals(final List<byte[]> lhs, final List<byte[]> rhs) { if (lhs != rhs) { if (lhs == null || rhs == null || lhs.size() != rhs.size()) { return false; } for (int i = 0; i < lhs.size(); i++) { if (!Arrays.equals(lhs.get(i), rhs.get(i))) { return false; } } } return true; } }
ParsecEqualsUtil { static boolean byteArrayListEquals(final List<byte[]> lhs, final List<byte[]> rhs) { if (lhs != rhs) { if (lhs == null || rhs == null || lhs.size() != rhs.size()) { return false; } for (int i = 0; i < lhs.size(); i++) { if (!Arrays.equals(lhs.get(i), rhs.get(i))) { return false; } } } return true; } private  ParsecEqualsUtil(); }
ParsecEqualsUtil { static boolean byteArrayListEquals(final List<byte[]> lhs, final List<byte[]> rhs) { if (lhs != rhs) { if (lhs == null || rhs == null || lhs.size() != rhs.size()) { return false; } for (int i = 0; i < lhs.size(); i++) { if (!Arrays.equals(lhs.get(i), rhs.get(i))) { return false; } } } return true; } private  ParsecEqualsUtil();  }
ParsecEqualsUtil { static boolean byteArrayListEquals(final List<byte[]> lhs, final List<byte[]> rhs) { if (lhs != rhs) { if (lhs == null || rhs == null || lhs.size() != rhs.size()) { return false; } for (int i = 0; i < lhs.size(); i++) { if (!Arrays.equals(lhs.get(i), rhs.get(i))) { return false; } } } return true; } private  ParsecEqualsUtil();   }