To the experienced:
I am using java to process some data with around 25,000 rows, say from a text data file such as:
Field1:Field2:Old_ID:Field4:Field5:Field6: ...
Now the ID in the Old_ID field is the old ID, and we are in the transition period that need to have all the old IDs converted into the new ID. Each row is a user and each user has a unique ID. A conversion table is provided for the conversion, and it contains only two fields:
Old_ID:New_ID
What I am doing now is putting all the rows from the conversion table into a Map. The Old_ID is the key and the New_ID is the value. Looping through the text data file, for each Old_ID value, I get the New_ID using
conversionMap.get(Old_ID)
That does the work OK. But it looks to me not very elegant. Suppose the conversion table has 40,000 rows. For 25,000 rows from the data file, the code will search through the 40,000 rows 25,000 times. What I am thinking is the SQL command, which would be
Select d.Fiels1, d.Field2, c.New_ID, d.Field4, d.Field5, d.Field6
from data_file d, conversion_table c
where d.Old_ID = c.Old_ID
which I guess would not go through the 40,000 rows 25,000 times under the hood.
Is there such a ready tool in the java API? Or is it left up to the developers on their own?
Thank you!
Newman