-1
List<myJavaClass> smallListnew = (List<myJavaClass>) i1.next();
위의 원인이 오류가 발생하면 개체를 List<myJavaClass>
으로 형식 형 변환 할 수 없습니다.개체 대 목록 예외에서 변환 할 수 없습니다.
List<myJavaClass> i1=bigList.iterator();
큰 목록은 다음과 같은 방법으로 많은 작은 목록이 포함되어 있습니다 :
//here unique list contains some Long values without the duplicates that were being compared with the refreshJobCountList.
Iterator<Long> i=uniqueRefJobId.iterator();
while (i.hasNext()) {
Long refreshJobID = i.next();
List<myJavaClass> smallList = new ArrayList<>();
for (myJavaClass details : refreshJobCountList) {
if (refreshJobID.equals(details.getRefreshJobId())) {
myJavaClass new_obj=new myJavaClass();
new_obj.setCount(details.getCount());
new_obj.setJobRunId(details.getJobRunId());
new_obj.setRefreshJobId(details.getRefreshJobId());
smallList.add(new_obj);
}
}
bigList.addAll(smallList);
}
이 점을 이해하는 데 의심의 여지가있는 경우 해결책을 제공해주십시오. – swati
'i1'은 어떤 타입입니까? 타입 캐스팅보다는 –
이라면 작은 목록의 요소를 큰 목록에 추가 할 수 있습니까? '.addAll'이 효과가 있습니까? –