@Test public void testPartListEquals() throws Exception { List<Part> partList1 = Arrays.asList( new ByteArrayPart("abc", new byte[] {1,2,3}), new FilePart("abc", new File("src/test/java/com/yahoo/parsec/clients/ParsecEqualsUtilTest.java")), new StringPart("abc", "def") ); List<Part> partList2 = new ArrayList<>(); partList2.addAll(partList1); Assert.assertTrue(ParsecEqualsUtil.partListEquals(partList1, partList2)); partList2.add(new StringPart("def", "def")); Assert.assertFalse(ParsecEqualsUtil.partListEquals(partList1, partList2)); partList2.remove(1); Assert.assertFalse(ParsecEqualsUtil.partListEquals(partList1, partList2)); }
static boolean partListEquals(final List<Part> lhs, final List<Part> rhs) { if (lhs != rhs) { if (lhs == null || rhs == null || lhs.size() != rhs.size()) { return false; } for (int i = 0; i < lhs.size(); i++) { if (!partEquals(lhs.get(i), rhs.get(i))) { return false; } } } return true; }
ParsecEqualsUtil { static boolean partListEquals(final List<Part> lhs, final List<Part> rhs) { if (lhs != rhs) { if (lhs == null || rhs == null || lhs.size() != rhs.size()) { return false; } for (int i = 0; i < lhs.size(); i++) { if (!partEquals(lhs.get(i), rhs.get(i))) { return false; } } } return true; } }
ParsecEqualsUtil { static boolean partListEquals(final List<Part> lhs, final List<Part> rhs) { if (lhs != rhs) { if (lhs == null || rhs == null || lhs.size() != rhs.size()) { return false; } for (int i = 0; i < lhs.size(); i++) { if (!partEquals(lhs.get(i), rhs.get(i))) { return false; } } } return true; } private  ParsecEqualsUtil(); }
ParsecEqualsUtil { static boolean partListEquals(final List<Part> lhs, final List<Part> rhs) { if (lhs != rhs) { if (lhs == null || rhs == null || lhs.size() != rhs.size()) { return false; } for (int i = 0; i < lhs.size(); i++) { if (!partEquals(lhs.get(i), rhs.get(i))) { return false; } } } return true; } private  ParsecEqualsUtil();  }
ParsecEqualsUtil { static boolean partListEquals(final List<Part> lhs, final List<Part> rhs) { if (lhs != rhs) { if (lhs == null || rhs == null || lhs.size() != rhs.size()) { return false; } for (int i = 0; i < lhs.size(); i++) { if (!partEquals(lhs.get(i), rhs.get(i))) { return false; } } } return true; } private  ParsecEqualsUtil();   }