I have a TreeMap<String, Customer> (Customer is a class I have created).
Customer objects hold a HashMap<String, Repair> (Repair is a class I created).
I wrote a method to find a given Repair, this is it:
public void processFindRef()
{
if(ref.length() == 6) // ref is the string we want to find, it should be 6 characters long
{
for(Customer c : aMap.values()) // loop through the treemap
{
bMap = c.getRepairs();
for(String s : bMap.keySet()) // loop through the hashmap
{
if(s.equals(ref)) // what to do if ref is found as a key in bmap(hashmap)
{
gui.results.setText(c.getName() + (": ") + c.toString() + newline + ref + newline + bMap.get(ref).toString());
}
}
}
}
else
{
JOptionPane.showMessageDialog(frame, "Job number does not exist", "Error",
JOptionPane.WARNING_MESSAGE);
}
}
Now I need to write a method that removes the Repair from the hashmap(repairs) that a Customer object holds. So far I have this:
public void processDeleteRef()
{
processFindRef();
JOptionPane.showConfirmDialog(frame, "Do you really want to remove this job?",
"Warning", JOptionPane.YES_NO_OPTION);
}
Then i am llost as to what comes next!
Any help apprecciated!
Thanks