List of usage examples for java.util List set
E set(int index, E element);
From source file:de.ingrid.interfaces.csw.admin.EditTestSuiteHarvesterController.java
@RequestMapping(value = TEMPLATE_EDIT_HARVESTER, method = RequestMethod.POST) public String step1Post(final HttpServletRequest request, final HttpSession session, final ModelMap modelMap, @ModelAttribute("harvester") final TestSuiteHarvesterCommandObject harvester, final Errors errors) throws Exception { if (WebUtils.hasSubmitParameter(request, "back")) { return "redirect:" + ManageHarvesterController.TEMPLATE_LIST_HARVESTER; }// w w w . j av a 2s . c o m if (_validatorStep1.validate(errors).hasErrors()) { return "/edit_testsuite_harvester"; } // transform to absolute path harvester.setWorkingDirectory((new File(harvester.getWorkingDirectory())).getAbsolutePath()); RecordCacheConfiguration rcc = new RecordCacheConfiguration(); rcc.setCachePath(new File(harvester.getWorkingDirectory(), "records").getAbsoluteFile()); harvester.setCacheConfiguration(rcc); Configuration configuration = cProvider.getConfiguration(); List<HarvesterConfiguration> hConfigs = configuration.getHarvesterConfigurations(); hConfigs.set(harvester.getId(), (HarvesterConfiguration) harvester); if (log.isDebugEnabled()) { log.debug("Save configuration to: " + cProvider.getConfigurationFile()); } cProvider.write(configuration); return "/edit_testsuite_harvester"; }
From source file:fr.eolya.utils.http.HttpUtils.java
public static boolean urlBelongSameHost(String urlReferer, String urlHref, List<String> hostAliases) { if (urlReferer != null && urlBelongSameHost(urlReferer, urlHref)) return true; if (hostAliases != null) { for (int i = 0; i < hostAliases.size(); i++) { hostAliases.set(i, hostAliases.get(i).trim()); if (hostAliases.get(i).indexOf("*") == -1) { if (urlBelongSameHost(hostAliases.get(i), urlHref)) return true; } else { String alias = hostAliases.get(i).replace("*", ""); if (hostAliases.get(i).indexOf("*") == 0) { if (urlHref.endsWith(alias)) return true; }/* w w w .j a va 2 s. c o m*/ if (hostAliases.get(i).indexOf("*") == hostAliases.get(i).length() - 1) { if (urlHref.startsWith(alias)) return true; } } } } return false; }
From source file:com.htmlhifive.pitalium.core.selenium.PtlFirefoxDriver.java
@Override protected void trimNonMovePadding(List<List<BufferedImage>> allTargetScreenshots, List<Pair<CompareTarget, ScreenshotParams>> targetParams) { LOG.trace("[Trim non-move elements' padding]"); // firefox?textarea?padding?????????padding? for (int i = 0; i < allTargetScreenshots.size(); i++) { PtlWebElement targetElement = targetParams.get(i).getRight().getTarget().getElement(); if ("textarea".equals(targetElement.getTagName()) && targetParams.get(i).getLeft().isScrollTarget()) { List<BufferedImage> targetScreenshots = allTargetScreenshots.get(i); for (int j = 0; j < targetScreenshots.size(); j++) { targetScreenshots.set(j, trimTargetPadding(targetElement, targetScreenshots.get(j), j, targetScreenshots.size())); }/*from w ww.ja v a2s . c o m*/ } } }
From source file:de.terministic.serein.core.genome.recombination.SimpleArithmeticRecombination.java
@Override DoubleGenome recombine(DoubleGenome g1, DoubleGenome g2, Random random) { int index = random.nextInt(g1.size()); List<Double> genes = new ArrayList<>(g1.getGenes()); for (int i = index; i < g1.size(); i++) { double value = dominance * g1.getGenes().get(i) + (1 - dominance) * g2.getGenes().get(i); genes.set(i, value); }/*from ww w .jav a 2 s . co m*/ return g1.createInstance(genes); }
From source file:org.springframework.cloud.stream.app.yahoo.quotes.source.YahooQuotesClientImpl.java
private String wouldbeSimplerWithLambdas(List<String> symbols) { for (int i = 0; i < symbols.size(); i++) { if (!symbols.get(i).startsWith("'") && !symbols.get(i).startsWith("\\")) symbols.set(i, StringUtils.quote(symbols.get(i))); }/*from w ww .j a v a2 s .c o m*/ return StringUtils.collectionToCommaDelimitedString(symbols); }
From source file:de.terministic.serein.core.genome.recombination.WholeArithmeticRecombination.java
@Override DoubleGenome recombine(DoubleGenome g1, DoubleGenome g2, Random random) { List<Double> genes = new ArrayList<>(g1.getGenes()); for (int i = 0; i < g1.size(); i++) { double value = dominance * g1.getGenes().get(i) + (1 - dominance) * g2.getGenes().get(i); genes.set(i, value); }/*from w ww .j a va2 s .c om*/ return g1.createInstance(genes); }
From source file:com.allinfinance.startup.init.MenuInfoUtil.java
/** * ??//from w w w. j a v a2 s .co m */ @SuppressWarnings("unchecked") public static void init() { String hql = "from com.allinfinance.po.TblFuncInf t where t.FuncType in ('0','1','2') order by t.FuncId"; ICommQueryDAO commQueryDAO = (ICommQueryDAO) ContextUtil.getBean("CommQueryDAO"); List<TblFuncInf> funcInfList = commQueryDAO.findByHQLQuery(hql); for (int i = 0, n = funcInfList.size(); i < n; i++) { TblFuncInf tblFuncInf = funcInfList.get(i); Map<String, Object> menuBean = new LinkedHashMap<String, Object>(); if (StringUtil.isEmpty(tblFuncInf.getIconPath()) || "-".equals(tblFuncInf.getIconPath().trim())) { menuBean.put(Constants.TOOLBAR_ICON, Constants.TOOLBAR_ICON_MENUITEM); } else { menuBean.put(Constants.TOOLBAR_ICON, tblFuncInf.getIconPath().trim()); } if (Constants.MENU_LVL_1.equals(tblFuncInf.getFuncType())) {//?? // Map<String, Object> menuBean = new LinkedHashMap<String, Object>(); menuBean.put(Constants.MENU_ID, tblFuncInf.getFuncId().toString().trim()); menuBean.put(Constants.MENU_TEXT, tblFuncInf.getFuncName().trim()); menuBean.put(Constants.MENU_CLS, Constants.MENU_FOLDER); allMenuBean.addJSONArrayElement(menuBean); } else if (Constants.MENU_LVL_2.equals(tblFuncInf.getFuncType())) {//?? // Map<String, Object> menuBean = new LinkedHashMap<String, Object>(); menuBean.put(Constants.MENU_ID, tblFuncInf.getFuncId().toString().trim()); menuBean.put(Constants.MENU_TEXT, tblFuncInf.getFuncName().trim()); menuBean.put(Constants.MENU_PARENT_ID, tblFuncInf.getFuncParentId().toString().trim()); menuBean.put(Constants.MENU_CLS, Constants.MENU_FOLDER); addLvl2Menu(menuBean); } else if (Constants.MENU_LVL_3.equals(tblFuncInf.getFuncType())) { // Map<String, Object> menuBean = new LinkedHashMap<String, Object>(); menuBean.put(Constants.MENU_ID, tblFuncInf.getFuncId().toString().trim()); menuBean.put(Constants.MENU_TEXT, tblFuncInf.getFuncName().trim()); menuBean.put(Constants.MENU_PARENT_ID, tblFuncInf.getFuncParentId().toString().trim()); menuBean.put(Constants.MENU_LEAF, true); menuBean.put(Constants.MENU_URL, tblFuncInf.getPageUrl().trim()); menuBean.put(Constants.MENU_CLS, Constants.MENU_FILE); // if("-".equals(tblFuncInf.getIconPath().trim())) { // menuBean.put(Constants.TOOLBAR_ICON, Constants.TOOLBAR_ICON_MENUITEM); // } else { // menuBean.put(Constants.TOOLBAR_ICON, tblFuncInf.getIconPath().trim()); // } addLvl3Menu(menuBean); } } //?? List<Object> menuLvl1List = allMenuBean.getDataList(); for (int i = 0; i < menuLvl1List.size(); i++) { Map<String, Object> menuLvl1Bean = (Map<String, Object>) menuLvl1List.get(i); if (!menuLvl1Bean.containsKey(Constants.MENU_CHILDREN)) { menuLvl1List.remove(i); i--; continue; } List<Object> menuLvl2List = (List<Object>) menuLvl1Bean.get(Constants.MENU_CHILDREN); for (int j = 0; j < menuLvl2List.size(); j++) { Map<String, Object> menuLvl2Bean = (Map<String, Object>) menuLvl2List.get(j); if (!menuLvl2Bean.containsKey(Constants.MENU_CHILDREN)) { menuLvl2List.remove(j); menuLvl1Bean.put(Constants.MENU_CHILDREN, menuLvl2List); menuLvl1List.set(i, menuLvl1Bean); allMenuBean.setDataList(menuLvl1List); j--; } } } }
From source file:com.fusionx.lightirc.ui.ChannelFragment.java
private void changeLastWord(final String newWord) { final String message = mMessageBox.getText().toString(); final List<String> list = IRCUtils.splitRawLine(message, false); list.set(list.size() - 1, newWord); mMessageBox.setText(""); mMessageBox.append(IRCUtils.concatenateStringList(list) + ": "); }
From source file:dk.clanie.bitcoin.client.response.ListAddressGroupingsResult.java
@SuppressWarnings({ "unchecked", "rawtypes" }) @JsonCreator// w ww. j a v a 2 s.c om private ListAddressGroupingsResult(Object[] objects) { this.objects = objects; Map<String, BalanceAndAccount> map = newHashMap(); for (Object object : objects) { List oa = (List) object; String address = (String) oa.get(0); BigDecimal amount = BigDecimal.valueOf((Double) oa.get(1)).setScale(BitcoindClient.SCALE); oa.set(1, amount); // Replace the Double with the BigDecimal to make Jackson serialize with right number of decimal places. String account = ((oa.size() > 2) ? (String) oa.get(2) : null); map.put(address, new BalanceAndAccount(amount, account)); } balanceAndAmountPerAddress = Collections.unmodifiableMap(map); }
From source file:edu.scripps.fl.hibernate.DoubleListStringType.java
public List<Double> getListFromString(String list) { String strs[] = list.split("\r?\n"); List<Double> ids = newList(strs.length); for (int ii = 0; ii < strs.length; ii++) { if (null != strs[ii] && !strs[ii].equals("")) { Double dbl = Double.parseDouble(strs[ii]); ids.set(ii, dbl); }/*from w w w. ja va 2s . c om*/ } return ids; }