URGENT: Most efficient way to read from multiple files and lexicographically write to another

Hey guys,

I was wondering if there was an efficient way of reading lines from multiple files and writing to a new file in lexicographic order.
I was thinking I would do:

  1. Read individual file store line in set. (Since, don't want to write duplicates)
  2. Use collections sort to write to new file.

Concerns:

  1. Would this still work if every file is huge ?
  2. What if there are a large number of files ?
  3. Would MultiThreading help ?

Thanks for the help!

Comments (1)