I am trying to query an active directory for ALL person objects. There are over 700,000 results which are way too many to read into a List. My current solution is using paging to get all of the results but I would much rather use the Java-8 Stream-API to get them instead. Unfortunately, I have not found any methods on LdapTemplate that return a Stream object.
I know that this can return all of the results:
public List<LdapPerson> findAll() {
return ldapTemplate.search("","(objectClass=person)", mapper);
}
but what I'm looking for is something that can return:
public Stream<LdapPerson> findAll(){
return ldaptemplate.?????????;
}
Can anyone point me in the right direction?