java - Comparing two Lists of same type of Objects -


assume have 2 lists, listold contains old employee information, listnew contains new employee information

employee {    long lastupdate; }  list<employee> listold; //arraylist list<employee> listnew; 

how compare both lists , return new list contains, list of new employees added, new list contains, list of employees removed, new list contains employees lastupdate has changed?

i think of iterating on lists , comparing, end o(n2) time , done util class , more efficiently?

apache's commons.collections library has collectionutils class. class provides methods collection checking, including intersection, difference, , union.

see: http://commons.apache.org/proper/commons-collections/javadocs/api-3.2.1/index.html


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -