Hi. I want to return values from multiple Arraylist. How can I do that ? later I want to use these values in another class. Can somebody help
Thanks
Code:
class myClass{
public ArrayList<Rectangle> readFile()throws Exception {
String n = null;
// List draw;
try{
BufferedReader fh = new BufferedReader(new FileReader("myInputFile.txt"));
while(true){
n = fh.readLine();
if(n == null){
break;
}else{
String f[] = n.split("\t");
int iscntop = Integer.parseInt(f[3]);
int iscnbot = Integer.parseInt(f[4]);
int basestop = Integer.parseInt(f[5]);
int basesbot = Integer.parseInt(f[6]);
String stain = f[7];
List list = new ArrayList(Arrays.asList(f[3],f[4],f[5],f[6],f[7]));
List draw = new ArrayList(Arrays.asList("g.drawRect("+f[3]+","+"60"+","+width+","+"27"+")"));
List fill = new ArrayList(Arrays.asList("g.fillRect("+f[3]+","+"60"+","+width+","+"27"+")"));
List color = new ArrayList(Arrays.asList("g.setColor"+"("+"Color."+f[7]+")"));
// System.out.println(list);
System.out.println(draw);
System.out.println(color);
System.out.println(fill);
}
}//end while
fh.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
return draw, fill, color // Howto return multiple arraylists. I want to use them in another class.
}//end of readFile
Comment