void (ContentManager manager, Content content, boolean select) { final String contentName = content.getDisplayName(); Content[] contents = manager.getContents(); Content oldContentFound = null; for (Content oldContent : contents) { if (!oldContent.isPinned() && oldContent.getDisplayName().equals(contentName)) { oldContentFound = oldContent; break; } } manager.addContent(content); if (oldContentFound != null) { manager.removeContent(oldContentFound, true); } if (select) { manager.setSelectedContent(content); } }