I have to read a file. File is as below -
I have written below code wherein I read that file into hashtable.
public Hashtable<String, String> readDataFromFile(String fileName) {
try {
FileReader fr = new FileReader(fileName);
BufferedReader br = new BufferedReader(fr);
String strLine = null;
String []prop = null;
while((strLine = br.readLine()) != null) {
prop = strLine.split("\t");
recruiters.put(prop[0], prop[1]);
}
br.close();
fr.close();
}catch(Exception exception) {
System.out.println("Unable to read data from recruiter file: " + exception.getMessage());
}
return recruiters;
}
This function returns a hashtable with first argument as id and second as the link
Now, I want to write a function in which I can read the hashtable and also append the second argument to first and that function should return a total url as result..
something like www.abc.com/123
This is how I started but its not working for me.. Plesae suggest improvement.
public String readFromHashtable(Hashtable recruiters){
String url=null;
Set<String> keys = hm.keySet();
for(String key: keys){
//Reading value and key
// Appending id into url and returning each of the url.
}
return url;
}