Skip to content

Instantly share code, notes, and snippets.

@fregmented
Created April 9, 2015 22:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fregmented/40f054089a669fca7337 to your computer and use it in GitHub Desktop.
Save fregmented/40f054089a669fca7337 to your computer and use it in GitHub Desktop.
private synchronized void buildListsByPlaylist(){
ConcurrentMap<String, List<MediaMetadata>> newMusicListByPlaylist = new ConcurrentHashMap<>();
for(MutableMediaMetadata m : mMusicListById.values()){
String playlist = m.metadata.getString(CUSTOM_METADATA_PLAYLIST_NAME);
List<MediaMetadata> list = newMusicListByPlaylist.get(playlist);
Log.e("buildListsByPlaylist", playlist);
if(list == null){
list = new ArrayList<>();
newMusicListByPlaylist.put(playlist, list);
}
list.add(m.metadata);
}
mMusicListByPlaylist = newMusicListByPlaylist;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment