List<ExpenseDetailsWrapper> expenseDataList = reimbursementLocalService
.getAllExpenseByReimbursementId(reimbursementId);
long fileEntryId = 0;
String previewURL = StringPool.BLANK;
List<String> billUrlData = new ArrayList<String>();
List<String> finalMerge = new ArrayList<String>();
try {
for (int i = 0; i < expenseDataList.size(); i++) {
fileEntryId = expenseDataList.get(i).getFileEntryId();
if (fileEntryId > 0) {
FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(fileEntryId);
previewURL = DLUtil.getPreviewURL(fileEntry, fileEntry.getFileVersion(), themeDisplay, StringPool.BLANK);
}
renderRequest.setAttribute("previewUrl", previewURL);
finalMerge.add(billUrlData);
finalMerge.add(expenseDataList);//**Error is here**The method addAll(Collection<? extends String>) in the type List<String> is not applicable for the arguments (List<ExpenseDetailsWrapper>)
LOG.info("File Entries"+fileEntryId);
}
LOG.info(billUrlData);
renderRequest.setAttribute("previewUrl", billUrlData);
renderRequest.setAttribute("expenseDataList", expenseDataList);
} catch (Exception e) {
e.printStackTrace();
}
我有一个列表与POJO和另一个列表与字符串..但当我试图将这两个列表添加到一个它给我错误 我可以追加两个不同类型的列表??
答案 0 :(得分:0)
是的,你可以使用List<Object> expenseDataList
,但在检索时你需要小心并施展它。
for(Object obj : expenseDataList)
{
if(obj instanceof YourPOJO)
//take action
}