### Question:
Range implements Serializable { public static List<Range> normalize(List<Range> ranges) { List<Range> newRanges = new ArrayList<>(); List<IMSTimePoint> imsTimePoints = IMSTimePoint.build(ranges); TreeSet<IMSTimePoint> imsTimePointTreeSet = new TreeSet<>(imsTimePoints); Iterator<IMSTimePoint> it = imsTimePointTreeSet.iterator(); String day = ""; int sh = -1; int eh = -1; while (it.hasNext()) { IMSTimePoint imsTimePoint = it.next(); if (!day.equals(imsTimePoint.getDate()) && !day.equals("")) { Range newRange = new Range(); newRange.st = day; newRange.ed = day; newRange.sh = String.valueOf(sh); newRange.eh = String.valueOf(eh); newRanges.add(newRange); day = ""; sh = -1; } if (day.equals("")) { day = imsTimePoint.getDate(); } if (sh == -1) { sh = imsTimePoint.getHourIndex(); } eh = imsTimePoint.getHourIndex(); } if (((newRanges.size() > 0 && !day.equals(newRanges.get(newRanges.size() - 1).getSt())) || (newRanges.size() == 0)) && !day.equals("")) { Range newRange = new Range(); newRange.st = day; newRange.ed = day; newRange.sh = String.valueOf(sh); newRange.eh = String.valueOf(eh); newRanges.add(newRange); } return newRanges; } Range();  Range(String st, String ed, String sh, String eh); int getLength(); static int getLength(String smallerDate, String BiggerDate); String getSt(); void setSt(String st); String getEd(); void setEd(String ed); String getSh(); void setSh(String sh); String getEh(); void setEh(String eh); static List<Range> normalize(List<Range> ranges); static List<String> getDays(List<Range> ranges); @Override String toString();  }### Answer:
@Test public void normalize() { List<Range> ranges = new ArrayList<>(); Range r1 = new Range(); r1.setSt("2018-01-07"); r1.setEd("2018-01-07"); r1.setSh("0"); r1.setEh("23"); Range r2 = new Range(); r2.setSt("2018-01-09"); r2.setEd("2018-01-09"); r2.setSh("5"); r2.setEh("22"); Range r3 = new Range(); r3.setSt("2018-11-05"); r3.setEd("2018-11-05"); r3.setSh("7"); r3.setEh("11"); ranges.add(r1); ranges.add(r2); ranges.add(r3); List<Range> res = Range.normalize(ranges); assertEquals(ranges.toString(), res.toString()); }