Как из List получить значения

У меня есть запрос который возвращает List<Integer[]>. Как из этого листа вытянуть может быть в какой-нибудь массив значения, которые хранятся в нем. list.get(0) возвращает [Ljava.lang.Integer;@3ca895e8.

public List<Integer[]> getRation() {
    List<Integer[]> list = dishRepository.findRation();
    return list;
}

public interface DishRepository extends JpaRepository<Dish, Long> {
    @Query(value = "select d1.id as q,d2.id as qq,d3.id as qqq from dishes d1,dishes d2,dishes d3" +
            " where d1.type='breakfast' and d2.type='dinner' and d3.type='dinner'\n" +
            "and d1.diet='vegan' and d2.diet='vegan' and d3.diet='vegan'\n" +
            "and d1.calories + d2.calories + d3.calories < 1900\n" +
            "and d1.calories + d2.calories + d3.calories > 1800 ORDER BY RANDOM() LIMIT 1 ", nativeQuery = true)
    List<Integer[]> findRation(int x, int xx);
}

Лист содержит 3 Integer


Ответы (1 шт):

Автор решения: Alexandr

Попробуйте проитерировать

for (int[] array : List) {
    for (int i = 0; i < array.length; i++) {
        System.out.println(array[i]);
    }
}
→ Ссылка