Is it possible to combine below using Java 8 streams that if there is some value for “getCount()” then keep on adding elements to same list to till size of the list is more than getCount().
List<RequestObject> li = results().map(req -> new RequestObject(req())).collect(Collectors.toList());
if(Objects.nonNull(getCount())){
    while(li.size() <= getCount()) {
        li.addAll(li);
    }
}
 
     
     
     
     
    