Home > Blockchain >  Efficient way to get line number of bunch of string from a file
Efficient way to get line number of bunch of string from a file

Time:02-06

I want to search a list of strings from the file and get the line number. I am looking for an efficient way to do it. I don't want to search one string at a time and open and close file.

CodePudding user response:

Read each line and save the String found there into a Map<String, Integer>, which stores the line number in the value.

  •  Tags:  
  • Related