M
M
miha54182020-10-26 08:18:08
Java
miha5418, 2020-10-26 08:18:08

How to make it faster?

I have an Array of 500 entries, and the file contains 1,000,000 such entries.
I don't need to insert duplicates into the file.
I can read all the entries from the file into the HashSet and if there are those in the array that are already in the Set, remove them from the array and insert the rest into the file.
Or I can check each element of the array directly in the file, and remove duplicates.

What should be faster?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2020-10-26
@zagayevskiy

Use DB.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question