List of usage examples for java.util HashMap entrySet
Set entrySet
To view the source code for java.util HashMap entrySet.
Click Source Link
From source file:butla.springapp.SampleController.java
@RequestMapping(value = "/", method = RequestMethod.POST) @ResponseBody/* www . ja v a2s . c o m*/ public HashMap<String, String> forBenchmark(@RequestBody HashMap<String, String> request) { HashMap<String, String> filtered = new HashMap<String, String>(); for (Map.Entry<String, String> entry : request.entrySet()) { if (entry.getKey().toLowerCase().startsWith("a")) { filtered.put(entry.getKey(), entry.getValue()); } } return filtered; }
From source file:com.o2d.pkayjava.editor.view.ui.properties.panels.UIShaderPropertiesMediator.java
private String findShaderProgramName(HashMap<String, ShaderProgram> list, ShaderProgram object) { for (Map.Entry<String, ShaderProgram> entry : list.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); if (value == object) { return key; }//from w w w .j av a2 s .c o m } return null; }
From source file:WebApp.Service.BookService.java
public boolean Pay_Books(ShoppingCart shoppingcart) { List<Salestatics> salestatics = new ArrayList<>(); int userid = shoppingcart.getUserid(); HashMap<Integer, Integer> book_list = shoppingcart.getBooks(); Date time = new Date(); for (HashMap.Entry entry : book_list.entrySet()) { Salestatics tmp = new Salestatics(); Integer bookid = (Integer) entry.getKey(); Book book = getBookbyId(bookid); Integer size = (Integer) entry.getValue(); tmp.setBookid(book.getId());/* w w w. java 2 s . c om*/ tmp.setUserid(userid); tmp.setTime(time); tmp.setStatus("true"); tmp.setNumber(size); salestatics.add(tmp); } return dao.Pay_Books(salestatics); }
From source file:com.livgrhm.kansas.resources.AuthResource.java
private void addToAuthList(String email, String hash, java.sql.Date now, String ip) { // clear any hashmap entries for this userId HashMap authMapInst = this.authMap.getAuthMap(); Iterator i = authMapInst.entrySet().iterator(); while (i.hasNext()) { Map.Entry item = (Map.Entry) i.next(); AuthItem ai = (AuthItem) item.getValue(); if (ai.email.equals(email)) { i.remove();/*from w ww . ja v a 2s. co m*/ } } // now add the new key entry AuthItem ai = new AuthItem(); ai.email = email; ai.loginDate = now; ai.ipAddress = ip; authMapInst.put(hash, ai); System.out.println("PUT IN AUTHMAP HASH: " + hash); System.out.println("AUTHMAP SIZE: " + authMapInst.size()); this.authMap.setAuthMap(authMapInst); }
From source file:org.camunda.bpm.elasticsearch.jackson.JacksonMixInFilterModule.java
protected void setupMixIns(SetupContext context, HashMap<Class<? extends HistoryEvent>, Class> mixInFilters) { for (Map.Entry<Class<? extends HistoryEvent>, Class> mixInFilter : mixInFilters.entrySet()) { context.setMixInAnnotations(mixInFilter.getKey(), mixInFilter.getValue()); }/*from w w w. jav a 2 s. com*/ }
From source file:ch.unil.genescore.pathway.EffTestCalculator.java
public void addMetaGeneIds(HashMap<String, MetaGene> metaGenes) { for (Entry<String, MetaGene> e : metaGenes.entrySet()) { Gene gene = e.getValue();/* ww w . j a va 2s .co m*/ indexMap_.put(gene.id_, indexMap_.size()); } }
From source file:ch.unil.genescore.pathway.EffTestCalculator.java
public void addMetaGenes(HashMap<String, MetaGene> metaGenes) { for (Entry<String, MetaGene> e : metaGenes.entrySet()) { Gene g = e.getValue();//ww w . j av a 2 s. c o m Gene fake = new Gene(g.id_); fake.setChi2Stat(chiSquared1df_.sample()); genes_.put(g.id_, fake); } }
From source file:com.datatorrent.lib.util.AbstractBaseFrequentKeyValueMap.java
/** * Emits the result.//from w ww . jav a 2 s.c o m */ @Override public void endWindow() { HashMap<V, Object> vmap = new HashMap<V, Object>(); for (Map.Entry<K, HashMap<V, MutableInt>> e : keyvals.entrySet()) { V val = null; int kval = -1; vmap.clear(); HashMap<V, MutableInt> vals = e.getValue(); for (Map.Entry<V, MutableInt> v : vals.entrySet()) { if (kval == -1) { val = v.getKey(); kval = v.getValue().intValue(); vmap.put(val, null); } else if (compareValue(v.getValue().intValue(), kval)) { val = v.getKey(); kval = v.getValue().intValue(); vmap.clear(); vmap.put(val, null); } else if (v.getValue().intValue() == kval) { vmap.put(v.getKey(), null); } } if ((val != null) && (kval > 0)) { // key is null if no HashMap<K, HashMap<V, Integer>> tuple = new HashMap<K, HashMap<V, Integer>>(1); HashMap<V, Integer> valpair = new HashMap<V, Integer>(); for (Map.Entry<V, Object> v : vmap.entrySet()) { valpair.put(v.getKey(), new Integer(kval)); } tuple.put(e.getKey(), valpair); emitTuple(tuple); } } keyvals.clear(); }
From source file:gridool.db.partitioning.phihash.monetdb.MonetDBGraceMultiCSVsLoadJob.java
@Override public GridTaskResultPolicy result(GridTaskResult result) throws GridException { final GridTaskResultPolicy policy = super.result(result); HashMap<GridNode, MutableLong> map = result.getResult(); for (final Map.Entry<GridNode, MutableLong> e : map.entrySet()) { GridNode node = e.getKey();//from w w w .j a v a 2 s .c om MutableLong assigned = e.getValue(); MutableLong prev = asgginedMap.get(node); if (prev == null) { asgginedMap.put(node, assigned); } else { long v = assigned.longValue(); prev.add(v); } } return policy; }
From source file:com.jaredrummler.android.devices.DevicesToJson.java
public void createCodenamesJson(File dir) throws IOException { HashMap<String, List<Device>> codenames = getCodenames(devices); dir.mkdirs();/* ww w . j a va 2s . c o m*/ for (Map.Entry<String, List<Device>> entry : codenames.entrySet()) { File file = new File(dir, entry.getKey() + ".json"); String json = gson.toJson(entry.getValue()); FileUtils.write(file, json); } }