### Question:
ListUtil { public static List<?> simplifyListTypeIfPossible(List<Object[]> listArray) { if (listArray.isEmpty()) { return listArray; } if (listArray.get(0).length != 1) { return listArray; } List<Object> result = new ArrayList<Object>(); for (Object[] obj : listArray) { result.add(obj[0]); } return result; }  static List<?> simplifyListTypeIfPossible(List<Object[]> listArray);  }### Answer:
@Test public void testSimplifyListType() { List<Object[]> listArray; List<?> result; listArray = new ArrayList<Object[]>(); listArray.add(new String[]{"A", "B"}); listArray.add(new String[]{"A", "B"}); result = ListUtil.simplifyListTypeIfPossible(listArray); assertTrue(result.get(0) instanceof String[]); assertTrue(result.get(1) instanceof String[]); listArray = new ArrayList<Object[]>(); listArray.add(new String[]{"A"}); listArray.add(new String[]{"A"}); result = ListUtil.simplifyListTypeIfPossible(listArray); assertTrue(result.get(0) instanceof String); assertTrue(result.get(1) instanceof String); }