@Test public void testToExtents() { List<ExtentPair> pairs = Arrays.asList( new ExtentPair("extent1[0]", 0, "size1[1]", 1), new ExtentPair("extent2[3]", 3, "size2[4]", 4), new ExtentPair("extent3[5]", 5, null, null), new ExtentPair("extent[new][7]", null, "size[new][8]", null) ); List<ExtentItem> expected = Arrays.asList( new ExtentItem(0, "extent1[0]"), new ExtentItem(1, "size1[1]"), new ExtentItem(3, "extent2[3]"), new ExtentItem(4, "size2[4]"), new ExtentItem(5, "extent3[5]"), new ExtentItem(null, null), new ExtentItem(null, "extent[new][7]"), new ExtentItem(null, "size[new][8]") ); List<ExtentItem> result = PhysicalDescriptionMapper.toExtents(pairs); assertThat(result, Is.is(expected)); }
public static List<ExtentItem> toExtents(List<ExtentPair> pairs) { ArrayList<ExtentItem> items = new ArrayList<>(pairs.size() * 2); for (ExtentPair pair : pairs) { items.add(new ExtentItem(pair.getExtentIndex(), pair.getExtent())); items.add(new ExtentItem(pair.getSizeIndex(), pair.getSize())); } return items; }
PhysicalDescriptionMapper { public static List<ExtentItem> toExtents(List<ExtentPair> pairs) { ArrayList<ExtentItem> items = new ArrayList<>(pairs.size() * 2); for (ExtentPair pair : pairs) { items.add(new ExtentItem(pair.getExtentIndex(), pair.getExtent())); items.add(new ExtentItem(pair.getSizeIndex(), pair.getSize())); } return items; } }
PhysicalDescriptionMapper { public static List<ExtentItem> toExtents(List<ExtentPair> pairs) { ArrayList<ExtentItem> items = new ArrayList<>(pairs.size() * 2); for (ExtentPair pair : pairs) { items.add(new ExtentItem(pair.getExtentIndex(), pair.getExtent())); items.add(new ExtentItem(pair.getSizeIndex(), pair.getSize())); } return items; }  }
PhysicalDescriptionMapper { public static List<ExtentItem> toExtents(List<ExtentPair> pairs) { ArrayList<ExtentItem> items = new ArrayList<>(pairs.size() * 2); for (ExtentPair pair : pairs) { items.add(new ExtentItem(pair.getExtentIndex(), pair.getExtent())); items.add(new ExtentItem(pair.getSizeIndex(), pair.getSize())); } return items; }  List<ArrayItem> map(ModsDefinition mods); ModsDefinition mapPairs(ModsDefinition mods, List<ExtentPair> pairs); ModsDefinition map(ModsDefinition mods, List<ExtentPair> pairs, String preservationTreatment, String preservationStateOfArt); ModsDefinition map(ModsDefinition mods, List<ArrayItem> items); static List<ExtentPair> toPairs(List<ArrayItem> items); static List<ExtentItem> toExtents(List<ExtentPair> pairs); static String getPreservationTreatment(List<ArrayItem> items); static String getPreservationStateOfArt(List<ArrayItem> items); static List<T> filter(List<T> list, boolean include, Class<? extends ArrayItem>... types); }
PhysicalDescriptionMapper { public static List<ExtentItem> toExtents(List<ExtentPair> pairs) { ArrayList<ExtentItem> items = new ArrayList<>(pairs.size() * 2); for (ExtentPair pair : pairs) { items.add(new ExtentItem(pair.getExtentIndex(), pair.getExtent())); items.add(new ExtentItem(pair.getSizeIndex(), pair.getSize())); } return items; }  List<ArrayItem> map(ModsDefinition mods); ModsDefinition mapPairs(ModsDefinition mods, List<ExtentPair> pairs); ModsDefinition map(ModsDefinition mods, List<ExtentPair> pairs, String preservationTreatment, String preservationStateOfArt); ModsDefinition map(ModsDefinition mods, List<ArrayItem> items); static List<ExtentPair> toPairs(List<ArrayItem> items); static List<ExtentItem> toExtents(List<ExtentPair> pairs); static String getPreservationTreatment(List<ArrayItem> items); static String getPreservationStateOfArt(List<ArrayItem> items); static List<T> filter(List<T> list, boolean include, Class<? extends ArrayItem>... types);  }