0

I have a list of objects with list size of 500K. Each object in the list have a unique identifier. I want to validate the list for any duplicate objects(having the same identifier) and mark them with a flag. Since there are lot of elements in the list, the processing takes quite long time and i am not able to achieve within allotted time frame.

Is there any way to process the list in parallel(Using java Future/Callable)?

Thanks in advance. Mayuran

Mayuran
  • 669
  • 2
  • 8
  • 39

1 Answers1

3

I don't know what your definition of a long time is, but 500K object is not a lot. Most likely your algorithm is quite inefficient. Rather than relying on parallelisation (how would you parallelise this anyway?), consider using a better data structure/algorithm for this.

HashMap or HashSet should work quite well for this.

NPE
  • 486,780
  • 108
  • 951
  • 1,012
  • Thanks, but each object has to go through lot of validation scenarios. So validation for each object takes some time. So that i want to process in parallel – Mayuran Oct 14 '14 at 06:06
  • 1
    @Mayuran: That's not what your questions says. You might want to work on improving the clarity of the question then. – NPE Oct 14 '14 at 06:16