I am iterating over a list, calling dynamoDBMapper.query() which return a PaginatedQueryList.
public List<Person> getPerson(final List<UUID> personIds) {
return personIds.stream().map(personId -> dynamoDBMapper.query(Person.class, findByPersonId(personId)).stream()
.map(Person::getPerson))
.collect(toList());
}
I need to return List but the error I am getting is :
Required type:
List<Person>
Provided:
List<Stream<Person>>
Any help will be appreciated.
This a a quote from javadoc for class Collectors
Just few clarifying questions: what does method
Person::getPersonreturn? is it instance of a classPerson(that what I would expect for your code to work properly) or is it aStream? Also in your code what does methodtoList()do?