private AlbumBean addOrUpdateAlbum( Map<Integer, AlbumBean> map, SongBean song, boolean albumOnly) { // Add an album bean if (song != null && song.getAlbum() != null) { int hashCode = (song.getAlbum() + (albumOnly ? "" : '\uFFFF' + song.getArtist())).hashCode(); // Check if the album beam already exists AlbumBean album = map.get(hashCode); if (album == null) { album = new AlbumBean(); album.setAlbum(song.getAlbum()); map.put(hashCode, album); } // Update the album properties try { // Add the track id to the album bean album.addSong(song); album.incTracks(); album.setArtist(song.getArtist()); album.setGenre(song.getGenre()); album.setDisc_Count(song.getDisc_Count()); } catch (LibraryException le) { // There was an error adding the song to this album, remove it map.remove(hashCode); // Add to warning message warningList.add(song.getName() + " " + le); } return album; } return null; }