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
Post a Comment