public static boolean compareRawTaggedFields(List<RawTaggedField> first,
                                                 List<RawTaggedField> second) {
        if (first == null) {
            return second == null || second.isEmpty();
        } else if (second == null) {
            return first.isEmpty();
        } else {
            return first.equals(second);
        }
    }
@Test
    public void testCompareRawTaggedFields() {
        assertTrue(MessageUtil.compareRawTaggedFields(null, null));
        assertTrue(MessageUtil.compareRawTaggedFields(null, Collections.emptyList()));
        assertTrue(MessageUtil.compareRawTaggedFields(Collections.emptyList(), null));
        assertFalse(MessageUtil.compareRawTaggedFields(Collections.emptyList(),
            Collections.singletonList(new RawTaggedField(1, new byte[] {1}))));
        assertFalse(MessageUtil.compareRawTaggedFields(null,
            Collections.singletonList(new RawTaggedField(1, new byte[] {1}))));
        assertFalse(MessageUtil.compareRawTaggedFields(
            Collections.singletonList(new RawTaggedField(1, new byte[] {1})),
            Collections.emptyList()));
        assertTrue(MessageUtil.compareRawTaggedFields(
            Arrays.asList(new RawTaggedField(1, new byte[] {1}),
                new RawTaggedField(2, new byte[] {})),
            Arrays.asList(new RawTaggedField(1, new byte[] {1}),
                new RawTaggedField(2, new byte[] {}))));
    }