-1
두 개의 배열 목록이 있습니다. 두 번째 배열 목록의 필드 개체 요소 중 일부에서 첫 번째 배열 목록에 채우기 개체 요소가 필요하며이 프로젝트는 최상의 성능을 필요로합니다. 이 문제를 해결하는 가장 좋은 방법은 나를 위해.두 배열 배열을 첫 번째 배열의 구조 필드와 병합하십시오
제 배열에서의 객체의 구조 및 ArrayList <SellProductAmountDTO>
채우기 SellContractProduct 이드와 SellProductAmountDTO sellContractId 조건부 필드가 객체 OrderProductDTO.
public class SellProductAmountDTO {
private Long sellContractId;
private Long amount;
private OrderProductDTO orderProduct;
//getter ans setters
}
및 OrderProductDTO의 stucture :
public class OrderProductDTO {
private List<Long> costGroupId;
private Long productId;
}
와 두 번째 배열 목록의 객체 stucture ArrayList<SellContractProduct>
: 내가 제대로 문제를 이해한다면
public class SellContractProduct{
private Long id;
private Long rateGroupId;
private Long currencyRateGroupId;
private Set<BuyType> buyTypes;
private Consumption consumption;
private Long productId;
private SellContractCustomer sellContractCustomer;
private Set<Depot> depots = new HashSet<>();
private List<Long> costGroupIds;
private List<Long> currencyIds;
//getter and setters
}
으로 더 나은 성능을 가질 수 있는가? 네가 무엇을 요구하는지 알 수 없다. – shmosel
SellContractProduct리스트가 꽉 차서 OrderProductDTO의 costGroupId와 productId를 SellContractProduct에서 SellProductAmountDTO의 sellContractId가있는 조건부 SellContractProduct의 ID로 채 웁니다. – batnight
수행하려고 시도하고 목록을 표시하는 초기 코드를 제공하십시오 – tkruse