java - Reading and Storing Multiple Files -
what trying read multiple files , store contents of files data structure. know how many files have , names of files number , names of files can change. after read in contents of files , store them need able find specific string contains across files.
what having trouble have no idea easiest data structure task. thinking hashmap, , using file names key. work? there better data structure? using java
edit: have been reading contents of file arraylist because each line contains separate information need able reference in future.
if files not big enough can use simple map
map<string, list<string>> map = new hashmap<string, list<string>>();
key(string) file name value(arraylist) contents of file (lines)
if files big data structure not sufficient.
Comments
Post a Comment