So I'm writing a program which keeps a track of various documents like e-mails, memos, and reports. The documents are stored in an ArrayList called "active" by default, but the user has the option of transferring them to another ArrayList called "archive", using an identification code("docId").
I thought that this would be pretty straightforward but I'm running into this error and would appreciate your help in resolving it. Here's my code:
private static ArrayList active = new ArrayList();
private static ArrayList archive = new ArrayList();
public static void archiveDocument(double docId)
{
if(active.isEmpty() == true)
{
System.out.println(Messages.emptyList());
}
else
{
for(Object a : active)
{
Document doc = (Document) a;
if(doc.getIdNum() == docId)
{
archive.add(a);
active.remove(a);
System.out.printf(Messages.enteredIntoArchive(), doc.getIdNum());
}
else System.out.println(Messages.notFound());
}
}
}