I got problem when i add the last 7st item position, other 6 items work perfectly with auto removes whenhasEnded. I cant add the 7st item, and when i got other items like 1-6 and adding the 7st item my application got error:
java.util.ConcurrentModificationException
one the code:
 public List<LiveTvProgram> getLiveTvBookmarks() {
    String name = context.getString(R.string.preferences_bookmarks_live_tv);
    Set<String> bookmarks = preferenceHelper.getStringSet(name, name);
    ArrayList<LiveTvProgram> bookmarkList = new ArrayList<>();
    for (String title : bookmarks) {
        for (LiveTvProgram program : ChannelsManager.getInstance().getSelectedPrograms()) {
            if (program.getTitle().equals(title)) {
                if (program.hasEnded()) {
                    bookmarks.remove(title);
                } else {
                    bookmarkList.add(program);
                }
                break;
            }
        }
    }
    return bookmarkList;
}
With first for loop
for (String title : bookmarks) {
        for (LiveTvProgram program : ChannelsManager.getInstance().getSelectedPrograms()) {
            if (program.getTitle().equals(title)) {
                if (program.hasEnded()) {
                    bookmarks.remove(title);
                } else {
                    bookmarkList.add(program);
                }
                break;
            }
        }
    }
 
     
     
     
    