How to sum values from Java Hashmap I need some help, I'm learning by myself how to deal with maps in Java ando today i was trying to get the sum of the values from a Hashmap but now Im stuck.  This are the map values that I want to sum.  HashMap&lt;String, Float&gt; map = new HashMap&lt;String, Float&gt;();  map.put("First Val", (float) 33.0); map.put("Second Val", (float) 24.0);   Ass an additional question, what if I have 10 or 20 values in a map, how can I sum all of them, do I need to make a "for"?  Regards and thanks for the help.
How do I efficiently iterate over each entry in a Java Map? If I have an object implementing the Map interface in Java and I wish to iterate over every pair contained within it,  what is the most efficient way of going through the map?  Will the ordering of elements depend on the specific map implementation that I have for the interface?
How can I disable the Document Library drag and drop function? Before I start - I'm new to this SharePoint development lark and am slowly familiarising myself with it.  We're using SharePoint online and I have amended the SharePoint out-of-the-box document library to include some extra fields that are required when the user adds a new document.  If the user creates or uploads a new document then they are prompted to enter the required information. However if they use the drag and drop functionality the entry of the necessary fields is bypassed.  During my search I came across  which asks how to enforce metadata entry (which would be another good option for me). It also mentions disabling the drag and drop functionality by editing dragdrop.js and removing content from various methods.  I've had a look at the site collection I'm working on (to which I have full control) and I can't seem to find dragdrop.js (or the layouts folder for that matter).   Is this something that's held at site collection level or is it held at a higher level? I don't have admin rights above my site collection, do I need them? Do I need to use Visual Studio to make the necessary changes? (Currently I'm doing things through the web and having a bit of a play with Napa I don't have Visual Studio installed)  When I get there is it obvious what methods need to be removed? How can I tell SharePoint to use the new version of dragdrop.js? Is it just a case of saving a copy of the existing one to a different name and then editing the existing file?      I suppose the best place for me to have asked this question would probably have been on the existing post, but I am unable to post a comment on there, sorry... Deserializing JSON when sometimes array and sometimes object Is $\frac{1}{\sqrt{2}}$ a fraction or not? Matching a sentence with grep Develop rich API exposing Stack Overflow functionality I would love to see an actual native iPhone app for Stack Overflow, Server Fault, Super User, etc.  I've actually developed a number of iPhone apps myself, and would certainly be interested and willing in doing the bulk of the legwork, but it would be necessary for the SO team to expose a real API, instead of simply RSS feeds.  Maybe if there's enough demand behind this, we can convince the SO team to build a rich API, which could be useful for many other applications, not just an iPhone app. On the bash command-line, ↑ gives me the previous command. On the command-lines in ipython or matlab, when I type a few characters, ↑ gives me the previously entered command starting with those characters. How can I enable exactly this behaviour in bash? I am aware of more advanced ways of searching through the command-line history, but sometimes a simple way is more convenient. In the past, Google Chrome allowed toggling of plugins (like enabling/disabling Flash) from the chrome://plugins URL. This page no longer exists (as of Chrome 57.0.2987.98).   What is the way to access Chrome plugins from this point onwards? In a closed system, I know the rider wouldn't be able to change the combined center of gravity of the system by moving his weight around. If he pushes the bike to lean to the right, he would go to the left by the amount that would keep the combined cog the same.  But a bike with tires and a road under it is not a closed system, the tires wouldn't let the lower part of the bike left or right when tryingo to initiate lean. Does this mean it is possible to push with your bodies inertia to the bike, and the combined cog will be changed? I thing if you do so above the cog of the bike, you could, but I am not sure.  Edit: My question is not about if you can move the center of gravity of the bike at all. My question is about if can you change the combine cog of the system by moving around on the bike?  English is not my mother tongue, sorry for the confusion How to get part name in LaTeX ? How to use `ybar interval` without skipping the last value I realize I am taking a risk by reopening what seems to be an old, hoary, and thorny discussion. However, it seems that in all the long discussions about Meta Stack Exchange reputation, what it means, and why it's separate from reputation on other sites, I have never seen a complete answer to this question:  If reputation on Meta Stack Exchange is used by the community to indicate agreement with an opinion instead of the quality of a post, why is it still tied to site privileges?  The association between reputation and privileges makes sense on other Stack Exchange sites, where reputation is a measure of your participation in the site and the quality of your questions and answers. If you contribute positively to the community your reward is increased privileges, whereas your punishment for "polluting" the site with bad questions or unhelpful answers is a loss of privileges.  However, on Meta Stack Exchange, reputation is a measure of the popularity, not the quality, of your contributions. Tying reputation to privileges means that losing privileges on the site is a punishment for expressing an unpopular opinion, and gaining them is a reward for agreeing with the majority.   My opinion:  I don't think that tying privileges to popularity makes sense as a feedback system. It doesn't really encourage quality contributions, and even worse, acts to suppress minority opinions through the threat of losing privileges. As a user with fairly low reputation, I am afraid of asking a question that may be controversial, because if enough other members disagree with me I will be stripped of the ability to vote and chat. Even if I had higher reputation, I would still be concerned that expressing a controversial opinion would cause me to lose helpful privileges like editing and viewing close votes.   The FAQ tells new users "not to be concerned" by downvotes because all it means is that the community disagrees with them. However, I think new users have every right to be concerned about downvotes, because they still mean the loss of privileges. SQL Server: Examples of PIVOTing String data How does the Comma Operator work How does the comma operator work in C++?  For instance, if I do:  a = b, c;     Does a end up equaling b or c?   (Yes, I know this is easy to test - just documenting on here for someone to find the answer quickly.)  Update:  This question has exposed a nuance when using the comma operator.  Just to document this:  a = b, c;    // a is set to the value of b!  a = (b, c);  // a is set to the value of c!   This question was actually inspired by a typo in code.  What was intended to be  a = b; c = d;   Turned into  a = b,    //  &lt;-  Note comma typo! c = d; The names of the derived functors $\operatorname{Tor}$ and $\operatorname{Ext}$ seem quite cryptic to me. Does anyone know what these abbreviations stand for? I would be glad if someone could tell me where these names come from. How can I always run the command prompt as administrator? X, along with Y, "were" or "was"? I was interested in the following sentence which appeared in a   in The Washington Post, Politics, (WHO RUNS GOV).     She, along with Mark Childress, were set to be Daschle's deputies at   the White House before he stepped down.   Can someone clarify if the fragment "She, along with Mark Childress, were set to" is ungrammatical, as I think it is?  I would reword were with was because I think that the subject of the sentence - obviously, in grammatical terms - is "She", not "She" and "Mark Childress", but I'm not sure on this correction.  More precisely, I'm not so sure that "She, along with Mark Childress" is equivalent to She and Mark Childress with regard to the effects on the grammatical numbers. Find directories and files with permissions other than 775 / 664 Approximate order statistics for normal random variables Why does $x$ divided by zero not equal $x$? Why does $x$ divided by zero not equal $x$? After all, $x$ is not being divided by anything. Ubuntu with spyware? Richard Stallman states that Ubuntu "has installed surveillance code". See:   Is this true?   I agree with him that "Any excuse Canonical offers is inadequate....".