List of usage examples for java.util List removeAll
boolean removeAll(Collection<?> c);
From source file:com.stratio.ingestion.sink.decision.StratioDecisionSink.java
private List<Event> takeEventsFromChannel(Channel channel) { List<Event> events = new ArrayList<Event>(); for (int i = 0; i < this.batchsize; i++) { this.sinkCounter.incrementEventDrainAttemptCount(); events.add(channel.take());/* w w w . ja v a2 s . co m*/ } events.removeAll(Collections.singleton(null)); return events; }
From source file:it.swim.servlet.profilo.azioni.ModificaProfiloServlet.java
private List<Abilita> getListaAbilitaAggiungibili(String emailUtenteCollegato) throws RicercheException { // Ottengo abilita dall'insieme generale, gli sottraggo quelle che l'utente possiede gia' e poi passo // la lista alla jsp List<Abilita> abilitaInsiemeGenerale = ricerche.insiemeAbilitaGenerali(); List<Abilita> abilitaInsiemePersonale = ricerche.insiemeAbilitaPersonaliUtente(emailUtenteCollegato); abilitaInsiemeGenerale.removeAll(abilitaInsiemePersonale); return abilitaInsiemeGenerale; }
From source file:de.iteratec.iteraplan.presentation.dialog.ExcelImport.MassdataMemBean.java
public List<TypeOfBuildingBlock> getTypeOfBuildingBlocksForPartial() { List<TypeOfBuildingBlock> excludedTypes = Lists.newArrayList(TypeOfBuildingBlock.BUSINESSMAPPING); List<TypeOfBuildingBlock> displayForPartial = Lists.newArrayList(TypeOfBuildingBlock.DISPLAY); displayForPartial.removeAll(excludedTypes); Function<TypeOfBuildingBlock, String> tobToLocalizedName = new Function<TypeOfBuildingBlock, String>() { @Override// w ww . j a v a2 s.c om public String apply(TypeOfBuildingBlock input) { return MessageAccess.getString(input.toString(), UserContext.getCurrentLocale()); } }; return Lists.newArrayList(Ordering.natural().onResultOf(tobToLocalizedName).sortedCopy(displayForPartial)); }
From source file:fr.esrf.icat.manager.core.part.SameEntitiesMenuContribution.java
@AboutToShow public void aboutToShow(final List<MMenuElement> items, final @Named(IServiceConstants.ACTIVE_PART) MPart activePart, final @Named(IServiceConstants.ACTIVE_SELECTION) @Optional List<WrappedEntityBean> selection) { if (null == selection || selection.isEmpty()) { return;/*from ww w. j a va 2 s . c o m*/ } MCommand command = null; for (MCommand c : application.getCommands()) { if (ICAT_MANAGER_CORE_COMMAND_OPENENTITY.equals(c.getElementId())) { command = c; break; } } if (null == command) { LOG.error("Command {} not found", ICAT_MANAGER_CORE_COMMAND_OPENENTITY); return; } DataPart part; if (activePart instanceof DataPart) { part = (DataPart) activePart; } else { part = (DataPart) activePart.getObject(); } final WrappedEntityBean firstEntityBean = selection.get(0); final List<String> fields = new LinkedList<>(firstEntityBean.getMutableFields()); fields.removeAll(firstEntityBean.getEntityFields()); for (String fieldName : fields) { String entityFilter = makeFieldFilter(selection, fieldName); if (null == entityFilter) { continue; } MHandledMenuItem dynamicItem = MMenuFactory.INSTANCE.createHandledMenuItem(); dynamicItem.setCommand(command); dynamicItem.setLabel(StringUtils.capitalize(fieldName)); MParameter p = MCommandsFactory.INSTANCE.createParameter(); p.setName("icat-manager.core.commandparameter.filter"); p.setValue(entityFilter); dynamicItem.getParameters().add(p); MParameter pEntity = MCommandsFactory.INSTANCE.createParameter(); pEntity.setName("icat-manager.core.commandparameter.entity"); pEntity.setValue(firstEntityBean.getEntityName()); dynamicItem.getParameters().add(pEntity); MParameter pServer = MCommandsFactory.INSTANCE.createParameter(); pServer.setName("icat-manager.core.commandparameter.server"); pServer.setValue(part.getEntity().getServer().getServerURL()); dynamicItem.getParameters().add(pServer); dynamicItem.setEnabled(true); dynamicItem.setToBeRendered(true); dynamicItem.setVisible(true); items.add(dynamicItem); } if (items.size() > 0) { final MMenuSeparator separator = MMenuFactory.INSTANCE.createMenuSeparator(); separator.setToBeRendered(true); separator.setVisible(true); items.add(separator); } for (String fieldName : firstEntityBean.getEntityFields()) { final String entityName = firstEntityBean.getReturnType(fieldName).getSimpleName(); String entityFilter = makeFKEntityFilter(selection, fieldName); if (null == entityFilter) { continue; } final MHandledMenuItem dynamicItem = MMenuFactory.INSTANCE.createHandledMenuItem(); dynamicItem.setCommand(command); dynamicItem.setLabel(entityName); MParameter p = MCommandsFactory.INSTANCE.createParameter(); p.setName("icat-manager.core.commandparameter.filter"); p.setValue(entityFilter); dynamicItem.getParameters().add(p); MParameter pEntity = MCommandsFactory.INSTANCE.createParameter(); pEntity.setName("icat-manager.core.commandparameter.entity"); pEntity.setValue(firstEntityBean.getEntityName()); dynamicItem.getParameters().add(pEntity); MParameter pServer = MCommandsFactory.INSTANCE.createParameter(); pServer.setName("icat-manager.core.commandparameter.server"); pServer.setValue(part.getEntity().getServer().getServerURL()); dynamicItem.getParameters().add(pServer); dynamicItem.setEnabled(true); dynamicItem.setToBeRendered(true); dynamicItem.setVisible(true); items.add(dynamicItem); } }
From source file:de.innovationgate.wgpublisher.design.sync.FileContainerDeployment.java
public boolean isUpdated() throws InstantiationException, IllegalAccessException, IOException, WGDesignSyncException { FileObject metadataFile = getMetadataFile(); if (metadataFile.exists() && metadataFile.getContent().getLastModifiedTime() != _timestampOfMetadataFile) { return true; }//from w w w . ja v a 2 s. c o m List<FileObject> files = getFileContainerFiles(); Collections.sort(files, new FileNameComparator()); FileObject file; List<String> existingFiles = new ArrayList<String>(); // Check for new and updated files for (int i = 0; i < files.size(); i++) { file = (FileObject) files.get(i); if (isExcludedFileContainerFile(file)) { continue; } ContainerFile containerFile = getContainerFile(file); if (containerFile == null) { return true; } else if (existingFiles.contains(containerFile.getName().toLowerCase())) { // Possible on case-sensitive file systems. A file with same name and // different case has already been processed. Ignore this duplicate. issueWarning(file.getName().getPathDecoded()); continue; } else { existingFiles.add(containerFile.getName().toLowerCase()); if (containerFile.getTimestamp() != file.getContent().getLastModifiedTime()) { return true; } } } // Check for deleted files List<String> containerFiles = new ArrayList<String>(_files.keySet()); containerFiles.removeAll(existingFiles); if (containerFiles.size() > 0) { return true; } else { return false; } }
From source file:csns.web.controller.SectionController.java
@RequestMapping(value = "/section/edit", method = RequestMethod.GET) public String edit(@RequestParam Long id, ModelMap models) { Section section = sectionDao.getSection(id); Department department = section.getCourse().getDepartment(); List<User> instructors = new ArrayList<User>(); instructors.addAll(department.getFaculty()); instructors.addAll(department.getInstructors()); instructors.removeAll(section.getInstructors()); JSONArray jsonArray = new JSONArray(); for (User instructor : instructors) { Map<String, String> json = new HashMap<String, String>(); json.put("id", instructor.getId().toString()); json.put("value", instructor.getName()); json.put("label", instructor.getCin() + " " + instructor.getName()); jsonArray.put(json);/*from w ww .ja v a2 s.c om*/ } models.put("section", section); models.put("instructors", jsonArray); return "section/edit"; }
From source file:com.norconex.importer.handler.tagger.impl.RenameTagger.java
@Override public void tagApplicableDocument(String reference, InputStream document, ImporterMetadata metadata, boolean parsed) throws ImporterHandlerException { for (String from : renames.keySet()) { RenameDetails details = renames.get(from); List<String> fromValues = metadata.get(from); List<String> toValues = metadata.get(details.toField); if (details.overwrite || toValues == null) { toValues = fromValues;//from www. j a v a 2s . co m } else if (fromValues != null) { fromValues.removeAll(toValues); toValues.addAll(fromValues); } metadata.put(details.toField, toValues); metadata.remove(from); } }
From source file:com.muzima.service.HTMLFormObservationCreator.java
private List<Observation> extractObservationFromJSONObject(JSONObject jsonObject) throws JSONException, ConceptController.ConceptFetchException, ConceptController.ConceptSaveException { List<Observation> observations = new ArrayList<Observation>(); Iterator keys = jsonObject.keys(); while (keys.hasNext()) { String key = (String) keys.next(); observations.addAll(extractBasedOnType(jsonObject, key)); }/*from w w w.j ava 2s . c o m*/ observations.removeAll(Collections.singleton(null)); return observations; }
From source file:org.codhaus.groovy.grails.validation.ext.ConstrainedPropertyGunn.java
public static void removeConstraint(String name, Class<?> constraintClass) { Assert.hasLength(name, "Argument [name] cannot be null"); List<Object> objects = getOrInitializeConstraint(name); objects.remove(constraintClass);/* w w w.ja va2 s . c o m*/ List<Object> toRemove = new ArrayList<Object>(); for (Object object : objects) { if (constraintClass.isInstance(object)) { toRemove.add(object); } } objects.removeAll(toRemove); }
From source file:Main.java
private static <E> void updateList(List<E> origList, Collection<? extends E> updateList, boolean add, boolean replace, boolean remove, BiPredicate<? super E, ? super E> equalTester, BiConsumer<List<E>, Collection<? extends E>> adder) { List<E> itemsToRemove = null; List<E> itemsToAdd = null; for (E update : updateList) { boolean origListContainsUpdate = false; ListIterator<E> origIter = origList.listIterator(); while (origIter.hasNext()) { E orig = origIter.next();//from w w w .j av a 2 s. c om if (equalTester.test(orig, update)) { origListContainsUpdate = true; if (remove) { if (itemsToRemove == null) { itemsToRemove = new ArrayList<>(origList); } itemsToRemove.remove(orig); } if (replace) { origIter.set(update); } break; } } if (!origListContainsUpdate && add) { if (itemsToAdd == null) { itemsToAdd = new ArrayList<>(); } itemsToAdd.add(update); } } if (remove) { if (itemsToRemove != null) { origList.removeAll(itemsToRemove); } else { origList.clear(); } } if (itemsToAdd != null) { adder.accept(origList, itemsToAdd); } }