Can anyone please explain this code?. like how the objects are being manipulated here? What is being returned and where does it go? and when making the object what does (al) do in
al = fa.fetchArrayList(al);
btw this class is used to deserialize an ArrayList from a file which I serialized earlier
public class FetchArrayList {
ArrayList<Word> fetchArrayList(ArrayList<Word> arrayList)
{
ArrayList<Word> al = new ArrayList<Word>();
FileInputStream fis = new FileInputStream("C:/xyz");
ObjectInputStream ois = new ObjectInputStream(fis);
al.addAll((ArrayList<Word>) ois.readObject());
ois.close();
return al;
//this part i know
}
}
Here is how a make an object of this class
ArrayList al = new ArrayList();
FetchArrayList fa = new FetchArrayList();
al = fa.fetchArrayList(al);
How can i make this code better? im a rookie here lol