List of usage examples for java.util Collection remove
boolean remove(Object o);
From source file:uk.ac.ebi.intact.editor.services.curate.publication.PublicationEditorService.java
private void initialiseEvidences(Publication parent, Collection<Experiment> evidences) { Collection<Experiment> originalExperiments = new ArrayList<Experiment>(evidences); for (Experiment exp : originalExperiments) { if (!isExperimentInitialised(exp)) { Experiment reloaded = initialiseExperiment(exp); if (reloaded != exp) { evidences.remove(exp); parent.addExperiment(reloaded); }//from w w w.ja v a 2 s.c om } } }
From source file:uk.ac.ebi.intact.editor.services.curate.interactor.InteractorEditorService.java
private void initialiseInteractorMembers(Collection<Interactor> interactors) { Collection<Interactor> originalMembers = new ArrayList<Interactor>(interactors); InteractorCloner cloner = new InteractorCloner(); for (Interactor interactor : originalMembers) { if (!isInteractorInitialised(interactor)) { Interactor reloaded = initialiseInteractor(interactor, cloner); if (reloaded != null) { interactors.remove(interactor); interactors.add(reloaded); }/*from w w w . j a v a 2s .c o m*/ } } }
From source file:edu.berkeley.compbio.ncbitaxonomy.NcbiTaxonomyServiceEngineImpl.java
public void writeSynonyms(final Writer out) { //DepthFirstTreeIterator<Integer, PhylogenyNode<Integer>> i = getTree().depthFirstIterator(); Iterator<Integer> i = ncbiTaxonomyNodeDao.findAllIds().iterator(); // while (i.hasNext()) { //PhylogenyNode<Integer> n = i.next(); //Integer id = n.getPayload(); Integer id = i.next();/*from ww w .j a v a 2 s. c o m*/ try { out.append(id.toString()).append("\t"); String scientificName = findScientificName(id); out.append(scientificName).append("\t"); Collection<String> synonyms = synonymsOfIdNoCache(id); synonyms.remove(scientificName); out.append(DSStringUtils.join(synonyms, "\t")).append("\n"); } catch (NoSuchNodeException e) { logger.error("Error", e); } catch (IOException e) { logger.error("Error", e); } } }
From source file:ubic.gemma.core.loader.genome.gene.ncbi.homology.HomologeneServiceImpl.java
@Override public Collection<Long> getHomologues(Long ncbiId) { Collection<Long> NcbiGeneIds = new HashSet<>(); if (!this.ready.get()) { return NcbiGeneIds; }/*w w w . j a v a 2s . c om*/ Long groupId = this.getHomologeneGroup(ncbiId); if (groupId == null) return NcbiGeneIds; NcbiGeneIds = this.getNCBIGeneIdsInGroup(groupId); NcbiGeneIds.remove(ncbiId); // remove the given gene from the list return NcbiGeneIds; }
From source file:org.xwiki.filemanager.internal.job.MoveJob.java
/** * Deletes the given file from the specified parent folder. If the file has no other parent folders then it is moved * to the recycle bin. Otherwise it is only removed from the specified parent folder. * //from www .ja v a 2s . co m * @param file the file to be deleted * @param parentReference the folder from where to delete the file */ private void deleteFile(File file, DocumentReference parentReference) { Collection<DocumentReference> parentReferences = file.getParentReferences(); parentReferences.remove(parentReference); if (parentReferences.isEmpty()) { fileSystem.delete(file.getReference()); } else { fileSystem.save(file); } }
From source file:at.ac.tuwien.qse.sepm.gui.controller.impl.GridViewImpl.java
private void handleUpdatePhotos(List<Photo> photos) { LOGGER.debug("updating {} photos in grid", photos.size()); Platform.runLater(() -> {// w w w . ja v a2s . co m grid.updatePhotos(photos); // update the inspector selection Collection<Photo> entities = inspector.getEntities(); boolean updated = false; for (Photo photo : photos) { Optional<Photo> entity = entities.stream().filter(p -> p.getId().equals(photo.getId())).findFirst(); if (entity.isPresent()) { entities.remove(entity.get()); entities.add(photo); updated = true; } } if (updated) { inspector.setEntities(entities); } }); }
From source file:de.dhke.projects.cutil.collections.aspect.AspectMultiMapTest.java
/** * Test of get method, of class AspectMultiMap. *//* w w w.j ava2 s. c o m*/ @Test public void testGet_remove() { Collection<String> values = _aspectMap.get("1"); TestHelper.assertSequenceEquals(Arrays.asList("a", "A"), values); values.remove("a"); assertFalse(_aspectMap.containsValue("1", "a")); assertEquals(1, _listener.beforeRemoveEvents.size()); assertEquals(new DefaultMapEntry<>("1", "a"), _listener.beforeRemoveEvents.get(0).getItem()); assertEquals(1, _listener.afterRemoveEvents.size()); assertEquals(new DefaultMapEntry<>("1", "a"), _listener.afterRemoveEvents.get(0).getItem()); }
From source file:uk.ac.ebi.intact.editor.services.curate.participant.ParticipantEditorService.java
private void initialiseCvs(Collection<CvTerm> detectionMethods) { Collection<CvTerm> dets = new ArrayList<CvTerm>(detectionMethods); for (CvTerm det : dets) { if (!isCvInitialised(det)) { CvTerm reloaded = initialiseCv(det); if (reloaded != det) { detectionMethods.remove(det); detectionMethods.add(reloaded); }/*from w w w . jav a 2s .c o m*/ } } }
From source file:org.apache.usergrid.tools.DupAdminRepair.java
/** * When our usernames are equal, we need to check if our emails are equal. If they're not, we need to change the one * that DOES NOT get returned on a lookup by username *//*from w ww.j a v a 2 s.com*/ private void resolveUsernameConflicts(String targetDir, String userName, Collection<UUID> ids) throws Exception { // lookup the admin id UserInfo existing = managementService.getAdminUserByUsername(userName); if (existing == null) { logger.warn("Could not determine an admin for colliding username '{}'. Skipping", userName); return; } ids.remove(existing.getUuid()); boolean collision = false; EntityManager em = emf.getEntityManager(MANAGEMENT_APPLICATION_ID); for (UUID id : ids) { UserInfo other = managementService.getAdminUserByUuid(id); // same username and email, these will be merged later in the process, // skip it if (other != null && other.getEmail() != null && other.getEmail().equals(existing.getEmail())) { logger.info( "Users with the same username '{}' have the same email '{}'. This will be resolved later in " + "the process, skipping", userName, existing.getEmail()); continue; } // if we get here, the emails do not match, but the usernames do. Force // both usernames to emails collision = true; setUserName(em, other, other.getEmail()); } if (collision) { setUserName(em, existing, existing.getEmail()); } }
From source file:org.xwiki.filemanager.internal.job.MoveJob.java
/** * Move a file to a different parent folder. * /* w w w . j a v a2 s. c o m*/ * @param file the file to be moved * @param oldParentReference the parent folder to replace * @param newParent the new parent folder */ private void moveFile(File file, DocumentReference oldParentReference, Folder newParent) { // Check if a file with the same name already exits under the new parent folder. if (!prepareOverwrite(file.getName(), newParent, file.getReference())) { return; } Collection<DocumentReference> parentReferences = file.getParentReferences(); boolean save = parentReferences.remove(oldParentReference); save |= parentReferences.add(newParent.getReference()); if (save) { fileSystem.save(file); } }