private void load() { p.load(); int n = Integer.parseInt(p.getProperty("number_of_buddies", "0")); for (int i = 0; i < n; i++) { IMContact bud = new IMContact(p.getProperty("buddy" + i, ""), MessageCons.IM_STATUS_UNKNOWN); users.put(bud.getUsername(), bud); } }
private void save() { int n = users.size(); p.clear(); p.setProperty("number_of_buddies", n + ""); int i = 0; for (Enumeration en = users.elements(); en.hasMoreElements(); i++) { p.setProperty("buddy" + i, ((IMContact) en.nextElement()).getUsername()); } p.save("Buddy list"); }