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:WebApp.Action.BookAction.java
public String Jump_To_ShoppingCart() { String userid = ServletActionContext.getRequest().getParameter("userid"); ServletActionContext.getRequest().getSession().setAttribute("User", userid); HashMap<Integer, Integer> book_ids = shoppingcart.getBooks(); HashMap<Book, Integer> book_list = new HashMap<>(); for (HashMap.Entry entry : book_ids.entrySet()) { Integer bookid = (Integer) entry.getKey(); Book newbook = bookservice.getBookbyId(bookid); book_list.put(newbook, (Integer) entry.getValue()); }// ww w .j a v a2 s .co m ServletActionContext.getRequest().setAttribute("ShoppingCart", book_list); return SUCCESS; }
From source file:com.github.chenxiaolong.dualbootpatcher.RomConfig.java
public void setIndivAppSharingPackages(HashMap<String, SharedItems> pkgs) { mSharedPkgs = new HashMap<>(); for (Map.Entry<String, SharedItems> item : pkgs.entrySet()) { mSharedPkgs.put(item.getKey(), new SharedItems(item.getValue())); }/*from www . j ava 2s . com*/ }
From source file:net.orpiske.ssps.common.dependencies.cache.DependencyCacheDao.java
/** * Inserts a record into the inventory/*from w w w .j av a2 s .co m*/ * @param dependant A DTO containing the data to insert into the DB * @return The number of affected records * @throws java.sql.SQLException If unable to perform the query */ public int insert(PackageInfo dependant) throws SQLException { int count = 0; HashMap<String, String> map = dependant.getDependencies(); if (map == null) { return 0; } for (Map.Entry<String, String> entry : map.entrySet()) { String dependencyQualifiedName = entry.getKey(); String dependencyVersionRange = entry.getValue(); count += insert(dependant, dependencyQualifiedName, dependencyVersionRange); } return count; }
From source file:com.tongbanjie.tarzan.server.client.ClientManager.java
public void scanNotActiveChannel() { try {/*from w w w. j a v a 2 s . c o m*/ if (this.groupChannelLock.tryLock(LOCK_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)) { try { for (final Entry<String, HashMap<Channel, ClientChannelInfo>> entry : this.groupChannelTable .entrySet()) { final String group = entry.getKey(); final HashMap<Channel, ClientChannelInfo> chlMap = entry.getValue(); Iterator<Entry<Channel, ClientChannelInfo>> it = chlMap.entrySet().iterator(); while (it.hasNext()) { Entry<Channel, ClientChannelInfo> item = it.next(); final ClientChannelInfo info = item.getValue(); long diff = System.currentTimeMillis() - info.getLastUpdateTimestamp(); if (diff > CHANNEL_EXPIRED_TIMEOUT) { it.remove(); LOGGER.warn( "SCAN: remove expired channel[{}] from ClientManager groupChannelTable, client group name: {}", RpcHelper.parseChannelRemoteAddr(info.getChannel()), group); RpcHelper.closeChannel(info.getChannel()); } } } } finally { this.groupChannelLock.unlock(); } } else { LOGGER.warn("ClientManager scanNotActiveChannel lock timeout"); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); LOGGER.error("", e); } }
From source file:com.enonic.cms.business.portal.rendering.portalfunctions.IsWindowEmptyFunction.java
private String renderWindow(final WindowKey windowKey, final String[] params, final WindowRendererContext context) { HashMap<String, String> map = createParamsMap(params); WindowRenderer windowRenderer = windowRendererFactory.createPortletRenderer(context); RequestParameters portletParams = new RequestParameters(); for (Map.Entry<String, String> entry : map.entrySet()) { portletParams.addParameterValue(entry.getKey(), entry.getValue()); }/*from w w w . ja v a2 s. c om*/ RenderedWindowResult renderedWindowResult = windowRenderer.renderWindowInline(windowKey, portletParams); if (RenderTrace.isTraceOn()) { return TraceMarkerHelper.unwrapResultWithPortletMarker(renderedWindowResult); } else { return renderedWindowResult.getContent(); } }
From source file:ke.co.tawi.babblesms.server.persistence.utils.SentGroupMessageCount.java
/** * Method returns a HashMap with each status Name And its respective Count * /* ww w.ja va 2s. co m*/ * @param SentGroupUuid * @return HashMap<String , Integer> */ public HashMap<String, Integer> getGroupContactMessages(String SentGroupUuid) { HashMap<String, String> MsgSts = getMessageStatus(); HashMap<String, Integer> MapCount = new HashMap<>(); //put in the HashMap, Status name And its respective Count. for (Entry<String, String> sts : MsgSts.entrySet()) { MapCount.put(sts.getValue(), getContactMessageCount(SentGroupUuid, sts.getKey())); } return MapCount; }
From source file:jp.aegif.nemaki.cmis.factory.info.AclCapabilities.java
private LinkedHashMap<String, PermissionMapping> buildPermissionMaps() { LinkedHashMap<String, PermissionMapping> table = new LinkedHashMap<String, PermissionMapping>(); HashMap<String, ArrayList<String>> map = readPermissionMappingDefinitions(); //Build table for (Entry<String, ArrayList<String>> entry : map.entrySet()) { //FIXME WORKAROUND: skip canCreatePolicy.Folder if (PermissionMapping.CAN_CREATE_POLICY_FOLDER.equals(entry.getKey())) { continue; }/* w w w . j av a 2 s. com*/ PermissionMappingDataImpl mapping = new PermissionMappingDataImpl(); mapping.setKey(entry.getKey()); mapping.setPermissions(entry.getValue()); table.put(mapping.getKey(), mapping); } //Add customized permissions to table for (NemakiPermissionDefinition custom : nemakiPermissions) { customizeTable(custom, table); } return table; }
From source file:org.owasp.benchmark.score.report.Scatter.java
private void makeDataLabels(OverallResults or, XYPlot xyplot) { HashMap<Point2D, String> map = makePointList(or); for (Entry<Point2D, String> e : map.entrySet()) { if (e.getValue() != null) { Point2D p = e.getKey(); String label = sort(e.getValue()); XYTextAnnotation annotation = new XYTextAnnotation(label, p.getX(), p.getY()); annotation.setTextAnchor(p.getX() < 3 ? TextAnchor.TOP_LEFT : TextAnchor.TOP_CENTER); annotation.setBackgroundPaint(Color.white); annotation.setPaint(Color.blue); annotation.setFont(theme.getRegularFont()); xyplot.addAnnotation(annotation); }/*from w w w.j a va 2 s. c om*/ } }
From source file:com.example.klaudia.myapplication.Searcher.java
public JSONArray complexSearch(HashMap<String, String> nameValue) { String result = ""; Iterator it = nameValue.entrySet().iterator(); while (it.hasNext()) { Map.Entry pair = (Map.Entry) it.next(); Object key = pair.getKey(); Object value = pair.getValue(); //nie zapisujemy do resulta 2 poczatkowych liter klucza, czyli litery oznaczej typ danej i '_'. Kropka sluzy do oddzielenia pary (klucz, wartosc) if (key.toString() != "s_query" && value != null) result += key.toString().substring(2, key.toString().length()) + "=" + value + "."; }/* w w w . j a v a 2s . c o m*/ if (result.length() > 0 && result.charAt(result.length() - 1) == '.') result = result.substring(0, result.length() - 1); result = result.replace('.', '&'); String request = "https://spoonacular-recipe-food-nutrition-v1.p.mashape.com/recipes/searchComplex?limitLicense=false&number=10&offset=10&ranking=1&" + changeTextToRequest(result); recipesJSONArray = getJsonArrayFromRequest(request, "results"); return recipesJSONArray; }
From source file:com.example.klaudia.myapplication.Searcher.java
public boolean checkMapCorrectness(HashMap<String, String> nameValue) { boolean correct = true; for (Map.Entry pair : nameValue.entrySet()) { if (!checkTypeCorrectness(pair.getKey().toString(), pair.getValue().toString())) { correct = false;/*w ww . j a v a 2 s . co m*/ break; } } return correct; }