|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Bannato
Iscritto dal: Jan 2003
Città:
Messaggi: 4421
|
...[java]beans e hash map...
...allora il problema è questo...
...costruisco un bean legato ad hash map pescando elementi da un file di testo.... public static FilmsContainer recuperaElencoFilm() {FilmsContainer container = new FilmsContainer(); try { FileReader file = new FileReader("ElencoFilm1.txt"); BufferedReader buff = new BufferedReader(file); boolean eof = false; while (!eof) { String line = buff.readLine(); if (line == null) eof = true; else { FilmBean film = new FilmBean(); String vett[] = ((String)line).split("#"); film.setCodice(vett[0]); film.setTitolo(vett[1]); film.setGenere(new Integer(vett[2])); film.setDurata(vett[3]); container.setFilm(film); } } buff.close(); } catch (IOException e) { System.out.println("Errore " + e.toString()); } return container; } ...ora se devo inserire un nuovo elemento come faccio? |
|
|
|
|
|
#2 |
|
Bannato
Iscritto dal: Jan 2003
Città:
Messaggi: 4421
|
...forse ho risolto...mi ero dimenticato di attaccare il cervello
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 22:26.



















