@Test public void testSubListWithStartZeroAndPositiveSize() { Range range = new Range(0, 4); List<String> zeroToThree = Arrays.asList(new String[]{"0", "1", "2", "3"}); assertEquals(range.subList(zeroToHeight), zeroToThree); }
public List<String> subList(List<String> list) { List<String> results = new ArrayList<String>(); results.addAll(list); if (getAbsoluteSize() > 0) { int min = 0; int max = 0; min = this.start; if (min < 0) { min = (list.size()) + this.start; } max = min + this.size; if (min == 0 && max < 0) { min = list.size() + max; max = list.size(); } if (min > max) { int oldmax = max; max = min; min = oldmax; } if (min < 0) { min = 0; } if (max > list.size()) { max = list.size(); } results = results.subList(min, max); } return results; }
Range { public List<String> subList(List<String> list) { List<String> results = new ArrayList<String>(); results.addAll(list); if (getAbsoluteSize() > 0) { int min = 0; int max = 0; min = this.start; if (min < 0) { min = (list.size()) + this.start; } max = min + this.size; if (min == 0 && max < 0) { min = list.size() + max; max = list.size(); } if (min > max) { int oldmax = max; max = min; min = oldmax; } if (min < 0) { min = 0; } if (max > list.size()) { max = list.size(); } results = results.subList(min, max); } return results; } }
Range { public List<String> subList(List<String> list) { List<String> results = new ArrayList<String>(); results.addAll(list); if (getAbsoluteSize() > 0) { int min = 0; int max = 0; min = this.start; if (min < 0) { min = (list.size()) + this.start; } max = min + this.size; if (min == 0 && max < 0) { min = list.size() + max; max = list.size(); } if (min > max) { int oldmax = max; max = min; min = oldmax; } if (min < 0) { min = 0; } if (max > list.size()) { max = list.size(); } results = results.subList(min, max); } return results; } Range(int start, int size); }
Range { public List<String> subList(List<String> list) { List<String> results = new ArrayList<String>(); results.addAll(list); if (getAbsoluteSize() > 0) { int min = 0; int max = 0; min = this.start; if (min < 0) { min = (list.size()) + this.start; } max = min + this.size; if (min == 0 && max < 0) { min = list.size() + max; max = list.size(); } if (min > max) { int oldmax = max; max = min; min = oldmax; } if (min < 0) { min = 0; } if (max > list.size()) { max = list.size(); } results = results.subList(min, max); } return results; } Range(int start, int size); int getStart(); int getAbsoluteStart(); int getSize(); int getAbsoluteSize(); List<String> subList(List<String> list); }
Range { public List<String> subList(List<String> list) { List<String> results = new ArrayList<String>(); results.addAll(list); if (getAbsoluteSize() > 0) { int min = 0; int max = 0; min = this.start; if (min < 0) { min = (list.size()) + this.start; } max = min + this.size; if (min == 0 && max < 0) { min = list.size() + max; max = list.size(); } if (min > max) { int oldmax = max; max = min; min = oldmax; } if (min < 0) { min = 0; } if (max > list.size()) { max = list.size(); } results = results.subList(min, max); } return results; } Range(int start, int size); int getStart(); int getAbsoluteStart(); int getSize(); int getAbsoluteSize(); List<String> subList(List<String> list);  }