I'm tempted to say that it would be practical tie, but given that Method #1 doesn't do any parsing (rather slow) until it has the file/object it's looking for and Method #2 would be parsing a large file, I'd
guess that Method #1 would be faster, the difference increasing as the number of objects grows.
Disclaimer: Performance depends on a LOT of variables. There's only one way to be sure: Read
Java Platform Performance, write both schemes and
test, test, test.
Faster still would be to have some sort of in-order index file of the value you are searching on. You could do a binary search of the file using RandomAccessFile. Associated with the index could either a file name or an index into the huge file. Doing a linear search of anything more than a few values will be a big performance drain (see Disclaimer, above).