java - Sorting+merging lines of multiple files according to a timestamp -


I have several text files that represent logging entries that I need to parse later. Each file is 1 M is above the size and I have about 10 files. Each row has the following format:

  timestamp \ t data   

I merge all the files And the entries must be sorted by the timestamp value. There is no guarantee that entries of 1 file are in the correct chronological order.

What will be the smartest approach? My proxy code looks like this:

  list & lt; FileEntry & gt; EkBeglist = New Arrestist & lt; File Entry & gt; (); For each file {parse each row in an instance of the file extension; Add an example to a buglist; } Collections.sort (According to OneBigList, FileEntry.getTimestamp ());  

If you are not sure that your work will fit in the available memory, After parsing the database table, worry about putting your lines and how to order the data in the database (an index will help in the timestamp column: -)

If you are sure that there is a problem with the storage If not, then I

make sure your file entry class goes Second is hash code () , according to your sort order equals () and comparative .


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -