How to compare each record with all other records in a same List Java?

Hi Guys…

I have a list :


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++;
        }

Now, i dont know how to do the comparison checking… basically if there are matching records(records that having same value), i should get the key.

please guide…:eek: