@Test public void testSortByFilledFields() { List<IndexedRecord> empty = new ArrayList<IndexedRecord>(); CollapserUtils.sortByFilledDataFields(empty, SampleData.significantFields); assertTrue(empty.isEmpty()); List<IndexedRecord> oneElement = Lists.newArrayList((IndexedRecord)SampleData.metadataRecord13); CollapserUtils.sortByFilledDataFields(oneElement, SampleData.significantFields); assertEquals(Lists.newArrayList(SampleData.metadataRecord13), oneElement); List<IndexedRecord> list = Lists.newArrayList( (IndexedRecord)SampleData.metadataRecord11, SampleData.metadataRecord12, SampleData.metadataRecord13); CollapserUtils.sortByFilledDataFields(list, SampleData.significantFields); assertEquals(Lists.newArrayList(SampleData.metadataRecord12, SampleData.metadataRecord11, SampleData.metadataRecord13), list); CollapserUtils.sortByFilledDataFields(list, null); assertEquals(Lists.newArrayList(SampleData.metadataRecord11, SampleData.metadataRecord12, SampleData.metadataRecord13), list); }
public static <T extends IndexedRecord> void sortByFilledDataFields(List<T> records, final List<String> fields) { Collections.sort(records, new NumberOfFilledDataFieldsComparator(fields)); }
CollapserUtils { public static <T extends IndexedRecord> void sortByFilledDataFields(List<T> records, final List<String> fields) { Collections.sort(records, new NumberOfFilledDataFieldsComparator(fields)); } }
CollapserUtils { public static <T extends IndexedRecord> void sortByFilledDataFields(List<T> records, final List<String> fields) { Collections.sort(records, new NumberOfFilledDataFieldsComparator(fields)); } private  CollapserUtils(); }
CollapserUtils { public static <T extends IndexedRecord> void sortByFilledDataFields(List<T> records, final List<String> fields) { Collections.sort(records, new NumberOfFilledDataFieldsComparator(fields)); } private  CollapserUtils(); static boolean haveEqualSchema(Collection<IndexedRecord> records); static boolean isEnvelopeSchema(Schema schema); static String getOriginValue(IndexedRecord record); static IndexedRecord getDataRecord(IndexedRecord record); @SuppressWarnings("unchecked") static T getNestedFieldValue(IndexedRecord record, String fieldName); static int getNumberOfFilledFields(IndexedRecord record, List<String> fields); static void sortByFilledDataFields(List<T> records, final List<String> fields); static T merge(T base, T update); }
CollapserUtils { public static <T extends IndexedRecord> void sortByFilledDataFields(List<T> records, final List<String> fields) { Collections.sort(records, new NumberOfFilledDataFieldsComparator(fields)); } private  CollapserUtils(); static boolean haveEqualSchema(Collection<IndexedRecord> records); static boolean isEnvelopeSchema(Schema schema); static String getOriginValue(IndexedRecord record); static IndexedRecord getDataRecord(IndexedRecord record); @SuppressWarnings("unchecked") static T getNestedFieldValue(IndexedRecord record, String fieldName); static int getNumberOfFilledFields(IndexedRecord record, List<String> fields); static void sortByFilledDataFields(List<T> records, final List<String> fields); static T merge(T base, T update);  }