I have a native query which returns a
List<Object>. I want to convert this
List to a
Stream<Object>. These Objects are different columns from different tables of my database.
What is the best solution to do that? Create a DTO and convert a
Stream<DTO>? How can I do that?
DTO class has a proper constructor, you can write something like this:
List<Object> input = ... Stream<DTO> dtos = input.stream().map(arr -> new DTO(arr, arr, ... , arr[n]);