public synchronized void loadFromFile(){
  entries.clear();
  Path file=Paths.get(fileName);
  try (BufferedReader reader=Files.newBufferedReader(file,CHARSET)){
    String line;
    do {
      line=reader.readLine();
      AddressbookEntry parsedEntry=parseLine(line);
      if (parsedEntry != null) {
        entries.put(parsedEntry.getName(),parsedEntry);
      }
    }
 while (line != null);
  }
 catch (  IOException ex) {
    LOGGER.warning("Error reading addressbook: " + ex.getLocalizedMessage());
  }
  LOGGER.info("Read " + entries.size() + " addressbook entries from "+ fileName);
  scanCategories();
}

public synchronized void loadFromFile ( ) { entries . clear ( ) ; Path file = Paths . get ( fileName ) ; try ( BufferedReader reader = Files . newBufferedReader ( file , CHARSET ) ) { String line ; do { line = reader . readLine ( ) ; AddressbookEntry parsedEntry = parseLine ( line ) ; if ( parsedEntry != null ) { entries . put ( parsedEntry . getName ( ) , parsedEntry ) ; } } while ( line != null ) ; } catch ( IOException ex ) { LOGGER . warning ( "Error reading addressbook: " + ex . getLocalizedMessage ( ) ) ; } LOGGER . info ( "Read " + entries . size ( ) + " addressbook entries from " + fileName ) ; scanCategories ( ) ; }
loads the addressbook from file .
