我是流媒体新手,需要转换流
public PayeeFacilityResponse searchPayeeFacility(String providerTaxID) {
PayeeFacilityResponse payeeFacilityResponse = new PayeeFacilityResponse();
if (StringUtils.isNotEmpty(providerTaxID)) {
Doc doc = null;
try {
doc = getPayeeFacilityDoc(providerTaxID);
} catch (Exception e) {
e.printStackTrace();
return null;
}
Stream<ArrayOfPayeeFacility> facilityStream = doc.objects("//*[local-name()='PayeeFacilities']", ArrayOfPayeeFacility.class);
List<PayeeFacility> payeeFacilityList = new ArrayList<>();
//need to convert facilityStream to ArrayofPayeeFacility
ArrayOfPayeeFacility arrayOfPayeeFacility = new ArrayOfPayeeFacility();
payeeFacilityResponse.setPayeeFacilities(arrayOfPayeeFacility);
}
return payeeFacilityResponse;
}
这是ArrayOfPayeeFacility
public class ArrayOfPayeeFacility {
protected List<PayeeFacility> payeeFacility;
public ArrayOfPayeeFacility() {
}
public List<PayeeFacility> getPayeeFacility() {
if (this.payeeFacility == null) {
this.payeeFacility = new ArrayList();
}
return this.payeeFacility;
}
}
如何将工具流转换为列表? ArrayofPayeeFacility包含列表