I don't know why this piece of code is not passing.
Return true if each sub-list is individually in ascending order, false otherwise.
public static boolean allSubListsAscending(ArrayList<ArrayList<Integer>> list) {
for (ArrayList<Integer> intList : list) {
for (int j = 0; j < intList.size() - 1; j++) {
if (intList.get(j) > intList.get(j + 1))
return false;
}
}
return true;
}
@Test @Graded(description="AllSubListsAscendingComprehensive")
public void testAllSubListsAscendingComprehensive() {
testAllSubListsAscendingBasic();
assertFalse(ListOfListService.allSubListsAscending(null));
assertFalse(ListOfListService.allSubListsAscending(list4_nullItems));
ArrayList<ArrayList<Integer>> ascending = new ArrayList<ArrayList<Integer>>();
ascending.add(new ArrayList<Integer>(Arrays.asList(10, 20, 70, 90)));
ascending.add(new ArrayList<Integer>(Arrays.asList(100, 110, 120, 130)));
ascending.add(null);
ascending.add(new ArrayList<Integer>(Arrays.asList(10, 20, 70, 90)));
assertFalse(ListOfListService.allSubListsAscending(ascending));
currentMethodName = new Throwable().getStackTrace()[0].getMethodName();
}