I want to use JMapper
to map a List<Pojo>
which is my source to List<DTO>
which is my destination. Currently, I'm making use of ModelMapper
but it is not very efficient. I tried searching but couldn't find any solution. Can we map List to List using JMapper?
I found a solution. We can use following technique -
List<Pojo> response = repository.findAll();
JMapper<DTO, Pojo> mapper = new JMapper<>(DTO.class, Pojo.class);
List<DTO> result = response.stream().map(temp-> mapper.getDestination(temp))
.collect(Collectors.toList());