List of usage examples for java.util List remove
E remove(int index);
From source file:com.haulmont.cuba.web.gui.components.presentations.TablePresentations.java
protected void applyStylesForItem(com.vaadin.ui.MenuBar.MenuItem item, List<String> styles) { styles.remove(CUSTOM_STYLE_NAME_PREFIX); StringBuilder joinedStyle = new StringBuilder(CUSTOM_STYLE_NAME_PREFIX); for (String style : styles) { joinedStyle.append(" ").append(style); }/*from w w w . ja va 2 s . co m*/ item.setStyleName(joinedStyle.toString()); }
From source file:org.openwms.core.uaa.SecurityServiceImpl.java
/** * {@inheritDoc}//w w w. j av a 2s . co m * <p> * Triggers {@code UserChangedEvent} after completion. */ @Override @FireAfterTransaction(events = { UserChangedEvent.class }) public List<Grant> mergeGrants(String moduleName, List<Grant> grants) { Assert.notNull(moduleName, translator.translate(ExceptionCodes.MODULENAME_NOT_NULL)); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Merging grants of module:" + moduleName); } List<Grant> persisted = securityObjectRepository.findAllOfModule(moduleName + "%"); List<Grant> result = new ArrayList<>(persisted); grants.forEach(g -> { if (persisted.contains(g)) persisted.remove(g); else result.add(securityObjectRepository.save(g)); }); result.removeAll(persisted); if (!persisted.isEmpty()) { securityObjectRepository.delete(persisted); } return result; }
From source file:com.jaxio.jpa.querybyexample.ByPropertySelectorUtil.java
private <E> void byObjectOrModeSelector(Root<E> root, CriteriaBuilder builder, List<Predicate> predicates, SearchParameters sp, PropertySelector<? super E, ?> selector) { List<Predicate> selectorPredicates = newArrayList(); Path<?> path = jpaUtil.getPath(root, selector.getAttributes()); List<?> selected = selector.getSelected(); if (selected.contains(null)) { selected = newArrayList(selector.getSelected()); selected.remove(null); selectorPredicates.add(builder.isNull(path)); }//from www .j ava 2 s.c om if (isNotEmpty(selected)) { if (selected.get(0) instanceof Identifiable) { List<Serializable> ids = newArrayList(); for (Object selection : selected) { ids.add(((Identifiable<?>) selection).getId()); } selectorPredicates.add(path.get("id").in(ids)); } else { selectorPredicates.add(path.in(selected)); } } predicates.add(jpaUtil.orPredicate(builder, selectorPredicates)); }
From source file:com.perl5.lang.perl.psi.mixins.PerlSubDefinitionImplMixin.java
@Override public String getSubArgumentsListAsString() { List<PerlSubArgument> subArguments = getSubArgumentsList(); if (isMethod() && subArguments.size() > 0) subArguments.remove(0); int argumentsNumber = subArguments.size(); List<String> argumentsList = new ArrayList<String>(); for (PerlSubArgument argument : subArguments) { // todo we can mark optional subArguments after prototypes implementation argumentsList.add(argument.toStringShort()); int compiledListSize = argumentsList.size(); if (compiledListSize > 4 && argumentsNumber > compiledListSize) { argumentsList.add("..."); break; }/*from w ww . j av a2 s .c o m*/ } return argumentsList.size() > 0 ? "(" + StringUtils.join(argumentsList, ", ") + ")" : ""; }
From source file:gov.nih.nci.ncicb.tcga.dcc.datareports.web.json.ProjectCaseDashboardJsonController.java
/** * handle project case data json/*from ww w. j a va 2 s . com*/ * * @param model of request * @param start param for paging * @param limit param for paging * @param sort param for sorting * @param dir param for sorting * @param jsonFilterReq for url filtering * @param jsonFormFilter for web form filtering * @return model of request */ @RequestMapping(value = PROJECT_CASE_DASHBOARD_JSON_URL, method = RequestMethod.POST) public ModelMap projectCaseDashboardJsonHandler(final ModelMap model, @RequestParam(value = START) final int start, @RequestParam(value = LIMIT) final int limit, @RequestParam(value = SORT, required = false) final String sort, @RequestParam(value = DIR, required = false) final String dir, @RequestParam(value = FILTER_REQ, required = false) final String jsonFilterReq, @RequestParam(value = FORM_FILTER, required = false) final String jsonFormFilter) { List<String> diseaseTab = null; List<ProjectCase> projectCaseList = service.getAllProjectCaseCounts(); if (jsonFilterReq != null && !ProjectCaseDashboardConstants.EMPTY_PROJECT_CASE_DASHBOARD_FILTER.equals(jsonFilterReq)) { diseaseTab = commonService.processJsonMultipleFilter(DISEASE, jsonFilterReq); projectCaseList = service.getFilteredProjectCaseList(service.getAllProjectCaseCounts(), diseaseTab); } if (jsonFormFilter != null && !ProjectCaseDashboardConstants.EMPTY_PROJECT_CASE_DASHBOARD_FILTER.equals(jsonFormFilter)) { diseaseTab = commonService.processJsonMultipleFilter(DISEASE, jsonFormFilter); } final List<ProjectCase> filteredProjectCaseList = service.getFilteredProjectCaseList(projectCaseList, diseaseTab); final ProjectCase total = filteredProjectCaseList.remove(filteredProjectCaseList.size() - 1); final List<ProjectCase> sortedProjectCaseList = commonService.getSortedList(filteredProjectCaseList, service.getProjectCaseComparator(), sort, dir); sortedProjectCaseList.add(total); final List<ProjectCase> projectCaseData = commonService.getPaginatedList(sortedProjectCaseList, start, limit); final int totalCount = commonService.getTotalCount(filteredProjectCaseList); model.addAttribute(TOTAL_COUNT, totalCount); model.addAttribute(ProjectCaseDashboardConstants.PROJECT_CASE_DASHBOARD_DATA, projectCaseData); return model; }
From source file:it.unibas.spicygui.widget.caratteristiche.LineCoordinatesCollections.java
private boolean findOverlapX(List<LineCoordinates> overlapLines, LineCoordinates lineCoordinates) { for (LineCoordinates currentLine : overlapLines) { if (chechOverlapX(currentLine, lineCoordinates.getTopPoint())) { overlapLines.remove(currentLine); lineCoordinates.increaseXValue(OFFSET_X); return true; }/*from ww w. jav a2s . c om*/ } return false; }
From source file:morphy.service.RequestService.java
protected void removeRequestTo(UserSession userSession, Request instance) { if (!toMap.containsKey(userSession)) return;//from ww w .j a v a 2 s. com List<Request> rList = toMap.get(userSession); rList.remove(instance); }
From source file:com.liato.bankdroid.banking.banks.sebkort.SEBKortBase.java
@Override public Urllib login() throws LoginException, BankException { try {/*from ww w . j a va2 s .c o m*/ LoginPackage lp = preLogin(); urlopen.addHeader("Origin", String.format("https://%s", mApiBase)); urlopen.addHeader("Referer", String.format("https://%s/nis/m/%s/external/t/login/index", mApiBase, mProviderPart)); urlopen.addHeader("X-Requested-With", "XMLHttpRequest"); List<NameValuePair> postData = lp.getPostData(); postData.remove(mParamsTarget); postData.remove(mParamsErrorTarget); postData.add( new BasicNameValuePair("target", String.format("/nis/m/%s/login/loginSuccess", mProviderPart))); postData.add(new BasicNameValuePair("errorTarget", String.format("/nis/m/%s/external/login/loginError", mProviderPart))); LoginResponse r = mObjectMapper.readValue(urlopen.openStream(lp.getLoginTarget(), postData, true), LoginResponse.class); if ("Failure".equalsIgnoreCase(r.getReturnCode())) { throw new LoginException( !TextUtils.isEmpty(r.getMessage()) ? Html.fromHtml(r.getMessage()).toString() : res.getText(R.string.invalid_username_password).toString()); } } catch (ClientProtocolException e) { throw new BankException(e.getMessage()); } catch (IOException e) { e.printStackTrace(); throw new BankException(e.getMessage()); } return urlopen; }
From source file:com.inmobi.grill.server.EventServiceImpl.java
@Override public void removeListenerForType(GrillEventListener listener, Class<? extends GrillEvent> eventType) { synchronized (eventListeners) { List<GrillEventListener> listeners = eventListeners.get(eventType); if (listeners != null) { if (listeners.remove(listener)) { LOG.info("Removed listener " + listener); }//from w ww .j ava 2s.co m } } }