Home How to read each line and then find the missing document?
Reply: 0

How to read each line and then find the missing document?

user1001
1#
user1001 Published in June 19, 2018, 11:53 pm

Sample Input format:

Name of the file,  Author,  format type,  id,  content length.
resume,            abc,     pdf,          7,   90
resume,            asc,     doc,          2,   90
resume,            azc,     docx,         3,   90

Output:

Missing document format

pdf

2,3

doc

7,3

Here is my approach: take input from external txt file(Required).

File file = new File("//Users//Downloads//test_cases//input.txt");
ArrayList<String> al=new ArrayList<String>();//creating new generic arraylist  
BufferedReader br = new BufferedReader(new FileReader(file));
String st;  
  while ((st = br.readLine()) != null)                                
    al.add(st);
br.close();     

So, my question is which is apt data structure to use? After reading each line. also how should i approach in storing data ?
A sample code would be great help. thanks in advance.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.314657 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO