List of usage examples for java.util Set iterator
Iterator<E> iterator();
From source file:org.eclipse.gemini.naming.test.NamingTestCase.java
protected void unregisterAllServices() { Set keySet = m_mapOfServicesToRegistrations.keySet(); Iterator iterator = keySet.iterator(); while (iterator.hasNext()) { unregisterService(iterator.next()); }/*from w ww. j a v a 2s .c o m*/ }
From source file:org.schedoscope.metascope.util.SampleCacheLoader.java
public HiveQueryResult getSample(String fqdn) { MetascopeTable table = metascopeTableService.findByFqdn(fqdn); if (table == null) { return new HiveQueryResult("Internal error"); }/*from w w w . j a v a 2 s . c o m*/ Map<String, String> params = new HashMap<String, String>(); Set<MetascopeField> parameters = table.getParameters(); if (parameters.size() > 0) { MetascopeField parameter = parameters.iterator().next(); String parameterValue = metascopeTableService.getRandomParameterValue(table, parameter); params.put(parameter.getFieldName(), parameterValue); } HiveQueryResult queryResult = hiveQueryExecutor.executeQuery(table.getDatabaseName(), table.getTableName(), table.getFieldsCommaDelimited(), table.getParameters(), params); return queryResult; }
From source file:com.pureinfo.tgirls.utils.counts.CountsJob.java
public void execute() { logger.debug("to process counts."); CountsProcess cache = CountsProcess.getInstance(); Bag bag = new HashBag(); synchronized (cache) { bag.addAll(cache.getBag());/*from ww w. j a v a2 s.c o m*/ cache.clear(); } ISession session = null; try { session = LocalContextHelper.currentSession(); Set<String> bagKeySet = bag.uniqueSet(); for (Iterator<String> iterator = bagKeySet.iterator(); iterator.hasNext();) { String type = null; try { type = iterator.next(); Counts counts = new Counts(); counts.setType(type); counts.setCounts(bag.getCount(type)); counts.setCreateTime(); session.save(counts); } catch (Exception e) { logger.error("error when save counts:" + type, e); } } } catch (Exception e) { logger.error("error occur.", e); } finally { bag.clear(); if (session != null) try { session.close(); } catch (Exception e) { logger.error("error when close session.", e); } } }
From source file:example.springdata.redis.commands.KeyOperationsTests.java
/** * Uses {@code KEYS} command for loading all matching keys. <br /> * Note that {@code KEYS} is a blocking command that potentially might affect other operations execution time. <br /> * All keys will be loaded within <strong>one single</strong> operation. *///ww w.j a va 2 s . c o m @Test public void iterateOverKeysMatchingPrefixUsingKeysCommand() { generateRandomKeys(1000); Set<byte[]> keys = this.connection.keys(serializer.serialize(KEY_PATTERN)); printKeys(keys.iterator()); }
From source file:formatter.handler.post.FormatterPostHandler.java
/** * Parse the import params from the request * @param request the http request// ww w. j av a 2s . c om */ void parseImportParams(HttpServletRequest request) { Map tbl = request.getParameterMap(); Set<String> keys = tbl.keySet(); Iterator<String> iter = keys.iterator(); while (iter.hasNext()) { String key = iter.next(); String[] values = (String[]) tbl.get(key); for (int i = 0; i < values.length; i++) processField(key, values[i]); } }
From source file:com.redhat.rhn.frontend.struts.RhnListAction.java
protected List trackSet(RhnSet set, HttpServletRequest request) { List newlist = new ArrayList(); String hiddenvars = request.getParameter("newset"); String returnvisit = request.getParameter("returnvisit"); if (returnvisit != null || hiddenvars != null) { /**//from w w w . j av a 2 s .co m * We have been keeping track of newset and should * stick with what we've got so far. */ if (hiddenvars != null) { hiddenvars = hiddenvars.substring(1, hiddenvars.length() - 1); String[] vars = hiddenvars.split(","); for (int j = 0; j < vars.length; j++) { newlist.add(vars[j].trim()); } } } else { /** * This is the first time we've displayed the set and * need to init newset to the set given to us in the tag */ Set setlist = set.getElements(); Iterator itr = setlist.iterator(); while (itr.hasNext()) { RhnSetElement r = (RhnSetElement) itr.next(); //check for id combo values if (r.getElementTwo() == null) { newlist.add(r.getElement().toString()); } else { newlist.add(r.getElement().toString() + "|" + r.getElementTwo().toString()); } } } return newlist; }
From source file:org.mule.providers.soap.axis.wsdl.wsrf.AxisWsdlWsrfMessageDispatcher.java
/** * Do send.//from ww w . ja v a2 s . c o m * * @param event event * @return UMOMessage * @throws Exception exception */ protected UMOMessage doSend(UMOEvent event) throws Exception { UMOMessage messageResponse; messageResponse = super.doSend(event); try { Map map = (Map) event.getMessage().getProperty(WSRFParameter.WSRF_EXTRA_RESPONSE_MAP); Set keySet = map.keySet(); Iterator it = keySet.iterator(); String propertyName = ""; while (it.hasNext()) { propertyName = (String) it.next(); messageResponse.setProperty(propertyName, map.get(propertyName)); } } catch (Exception e) { Logger.getLogger(this.getClass()).log(Level.DEBUG, this.getClass().getName() + " : " + WSRFParameter.WSRF_EXTRA_RESPONSE_MAP + " property is null. IGNORED Advice extra reponse properties"); } return messageResponse; }
From source file:cn.itganhuo.app.web.filter.KeyWordRequestWrapper.java
@Override public Map<String, String[]> getParameterMap() { super.getContextPath(); Map<String, String[]> map = super.getParameterMap(); if (!map.isEmpty()) { Set<String> keySet = map.keySet(); Iterator<String> keyIt = keySet.iterator(); while (keyIt.hasNext()) { String key = keyIt.next(); String[] values = map.get(key); for (int i = 0; i < values.length; i++) { map.get(key)[i] = this.replaceParam(values[i]); }/*from w w w. j a va2 s . co m*/ } } return map; }
From source file:cop.maven.plugins.RamlMojoTest.java
@Test(groups = "getSourceDirectories") public void shouldReturnSourceDirectoryWhenSourceDirectoryNotEmpty() throws Exception { setSourceDirectories(mojo, new LinkedHashSet<File>() { {/* w ww .java 2 s . com*/ add(FileMock.createDirectory("aaa")); add(FileMock.createFile("bbb")); add(null); } }); Set<File> files = mojo.getSourceDirectories(); assertThat(files).hasSize(1); assertThat(files.iterator().next().getPath()).isEqualTo("aaa"); }
From source file:com.pactera.edg.am.metamanager.extractor.dao.impl.HistoryCompositionDaoImpl.java
private void batchLoadCreate(Set<MMMetaModel> metaModels) { for (Iterator<MMMetaModel> iter = metaModels.iterator(); iter.hasNext();) { MMMetaModel metaModel = iter.next(); if (metaModel.isHasMetadata()) { // ?/*from w w w .ja v a 2 s.c o m*/ batchLoadCreate(metaModel.getMetadatas()); } if (metaModel.isHasChildMetaModel()) { // ? batchLoadCreate(metaModel.getChildMetaModels()); } } if (count % Constants.MAX_EXPRESSION_SIZE != 0) { super.getJdbcTemplate().execute(getHistoryFullSql(childMetadataIds)); } }