data structures - java file input pair of numbers linkedlist -


i've been looking around , can't seem find best answer problem i'm doing. have .txt file need read in, looks little this:

1,10 5,16 2,7 4,12 3,19 

now i'm supposed create linked list fine, biggest problem i'm not sure how read in pair, first number represents process id , second amount of time takes before termination. want parseint string , grab each 1 separately before , after comma, or there easier way @ doing this. can't use arraylists either.

scanner fin = new scanner(new filereader(file));  while(fin.hasnext()){  int s = fin.nextint(); 

this have got far reading file in

is need?

scanner fin = new scanner(new filereader(file); string pattern = ","; fin.usedelimiter(pattern); while (fin.hasnext()) {     string s = fin.nextline();     string[] arr = s.split(pattern);     int processid = integer.parseint(arr[0]);     int time = integer.parseint(arr[1]); } 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -