Performance and scalability: What is best way to compare!!

  1. What is best way to compare!! (5 messages)

    I have two database tables say TAB1, TAB2.
    There are two ejbs for TAB1(EJB1)and TAB2(EJB2). EJB1 gives me a java.util.List of custom Person object. EJB2 also gives a java.util.List of custom Person object.
    List1 and List2 has some Person objects common. I need to compare these two List and need to create a new List which has unique of List1 and List2.
    Can someone tell which is the best way to do this?
    List 1and List2 has more than 3000 Person objects.

    Threaded Messages (5)

  2. List Algebra[ Go to top ]

    clone listA---calling listACloned

    now listA.removeAll(listB)
    now listACloned.removeAll(listA)

    Answer is listACloned :-)
  3. OOPS[ Go to top ]

    i mis read the question

    just use removeAll on both the lists using the other one
  4. OOPS[ Go to top ]

    I think it should be
  5. :-(
  6. Maybe out of context answer.. but why not simply do that in the DB and use a query/view (using a union-distinct) to publish the list in a new EJB?