e.g. Для AllLists = {{1,2,3}, {4,5,6}, {7,8,9}} , nth = 1 , функция вернет {2,5,8}
Код: Выделить всё
public static String[] getEveryNthElement(ArrayList allLists, int nth) {
String[] nthList = new String[allLists.size()];
int n = 0;
for (ArrayList sList: allLists) {
if (nth
Мне удалось получить версию, работающую там, где я могу ее распечатать: < /p>
group.stream()
.forEach(items -> {
System.out.println(items.get(1)); // prints 2, 5, 8
});
Подробнее здесь: https://stackoverflow.com/questions/679 ... va-streams