Avevo + o - lo stesso problema ed ho usato Hashtable.
codice:private static Hashtable table = new Hashtable(); ... public void salvaLista() { try { FileOutputStream ostream = new FileOutputStream(data.dat); ObjectOutputStream p = new ObjectOutputStream(ostream); p.writeObject(table); p.flush(); ostream.close(); } catch(IOException ioe) { System.out.println("Errore di scrittura"); } } public void caricaLista() { try { FileInputStream istream = new FileInputStream("dati.dat"); ObjectInputStream p = new ObjectInputStream(istream); table = (Hashtable) p.readObject(); istream.close(); } catch(FileNotFoundException nfc) { JOptionPane.showInternalMessageDialog(PropertiesTest1.getC(), "File non trovato", "Errore", JOptionPane.ERROR_MESSAGE); } }

Rispondi quotando