我有一个清单:
List<BookDTO> bookList = libraryDTO.getBooks();
int bookCounter = 0;
for (BookDTO bookdto : bookList)
{
if ((!errors.isEmpty() && !errors.containsKey("book[" + bookCounter + "].bookRefNo") || errors.isEmpty()) &&
// do comparison for each record with other records in same list ) {
errors.put("book[" + bookCounter + "].bookRefNo", messageSource.getMessage("bookRefNo.cannot.be.same", null, null));
}
bookCounter++;
}
现在,我不知道如何进行比较检查..基本上如果有匹配的记录(具有相同值的记录),我应该得到密钥。