I have the following map: Map&lt;InputTypeEnum, List&lt;Object&gt;&gt; objectsMap;  objectsMap.put(InputTypeEnum.Text, textList); objectsMap.put(InputTypeEnum.Number, NumbersList); objectsMap.put(InputTypeEnum.Symbols, SymbolsList);  I want to iterate through the Map and print to console the number of objects in list per InputTypeEnum. for example:  &quot;the text list has 4 elements&quot; &quot;the numbers list has 2 elements&quot; &quot;the symbols list has 5 elements&quot;  I couldn't find any example here, or in google. thanks for the help!
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?
The energy stored in a capacitor is $$ U= \dfrac{1}{2} CV^2 $$    So when I have a 1F supercap charged to 1V the energy is 0.5 J. When I connect a second supercap, also 1F in parallel the charge will distribute and the voltage will halve. Then    $$ U = \dfrac{1}{2} 2F (0.5V)^2 = 0.25 J $$  What happened to the other 0.25 J? GOTO still considered harmful? Everyone is aware of Dijkstra's  (also  .html transcript and  .pdf) and there has been a formidable push since that time to eschew the goto statement whenever possible. While it's possible to use goto to produce unmaintainable, sprawling code, it nevertheless remains in . Even the advanced  control structure in Scheme can be described as a sophisticated goto.  What circumstances warrant the use of goto? When is it best to avoid?  As a followup question: C provides a pair of functions, setjmp and longjmp, that provide the ability to goto not just within the current stack frame but within any of the calling frames. Should these be considered as dangerous as goto? More dangerous?    Dijkstra himself regretted that title, for which he was not responsible. At the end of  (also  .pdf) he wrote:     Finally a short story for the record.   In 1968, the Communications of the ACM   published a text of mine under the   title "The goto statement considered   harmful", which in later years would   be most frequently referenced,   regrettably, however, often by authors   who had seen no more of it than its   title, which became a cornerstone of   my fame by becoming a template: we   would see all sorts of articles under   the title "X considered harmful" for   almost any X, including one titled   "Dijkstra considered harmful". But   what had happened? I had submitted a   paper under the title "A case against   the goto statement", which, in order   to speed up its publication, the   editor had changed into a "letter to   the Editor", and in the process he had   given it a new title of his own   invention! The editor was Niklaus   Wirth.   A well thought out classic paper about this topic, to be matched to that of Dijkstra, is , by Donald E. Knuth. Reading both helps to reestablish context and a non-dogmatic understanding of the subject. In this paper, Dijkstra's opinion on this case is reported and is even more strong:     Donald E. Knuth: I believe that by presenting such a   view I am not in fact disagreeing   sharply with Dijkstra's ideas, since   he recently wrote the following:   "Please don't fall into the trap of   believing that I am terribly   dogmatical about [the go to   statement]. I have the uncomfortable   feeling that others are making a   religion out of it, as if the   conceptual problems of programming   could be solved by a single trick, by   a simple form of coding discipline!" What is the optimum pattern to place crops in Minecraft? What factors affect soil hydration and crop growth time? What is the most efficient layout of dirt and water to grow crops? How do I remove a malformed line from my sources.list? I have unistalled and reinstalled the Ubuntu Software Center as per info I found in a similar thread and I got the same response about line 91 or something like that.  I just tried to upload a screen shot but since I'm new it won't allow me to.  I also can not figure out how to cut and paste anything so I have to hand type what the error screen says, both when I attempt to open the software center and nothing happens, when I try to enter commands into the terminal to uninstall, reinstall, whatever I get the same following:  COULD NOT INTITIALIZE THE PACKAGE INFORMATION An unresolvable problem occured while initializing the package information Please report t:his bug against the 'update-manager' package and include the following error message: 'E: Malformed line 91 in source list/etc/apt/sources.list (dist parse)  E: The list of sources could not be read.,  E: The package list of status file could not be parsed or opened.   How do I report bugs?  What can be done about this.  I have searched and everything everyone says to do leads me back to the same line error message.  So, I don't know how to get to line 91 in the source list; to tell you what it says. Sorry, I'm really new to this. That is what I need is to find out how to get there and fix what it says. I would really like to NOT have to re partition my hard drive and start from scratch, so I'm really looking forward to getting this problem solved. I need to be able to install new software. I have absolutely no experience with Linux, and I desperately need to get my computer back up and running again with Windows.  How do I remove Ubuntu and reinstall Windows?    Editor's note: many of the answers are about removing Ubuntu from dual-boot but keeping Windows (which is a bit complicated), while other answers are about removing Ubuntu from single-boot (which is easy: basically just format the disk while installing Windows). The question as written is ambiguous between dual-boot or single-boot. Show that for any $k$-cycle $(a_1 a_2...a_k) \in S_n$, and for any permutation $\pi \in S_n$, $\pi(a_1...a_k)\pi^{-1}=(\pi(a_1)..\pi(a_k))$ I'm always on the hunt for free stock images to use while I design, what are some good resources for images that are under a a royalty free or creative commons licence? C# 3.0 Auto-Properties - Is it possible to add custom behaviour? I would like to know if there is any way to add custom behaviour to the auto property get/set methods.  An obvious case I can think of is wanting every set property method to call on any PropertyChanged event handlers as part of a System.ComponentModel.INotifyPropertyChanged implementation.  This would allow a class to have numerous properties that can be observed, where each property is defined using auto property syntax.  Basically I'm wondering if there is anything similar to either a get/set template or post get/set hook with class scope.  (I know the same end functionality can easily be achieved in slightly more verbose ways - I just hate duplication of a pattern) Elementary argument for conservation laws from symmetries *without* using the Lagrangian formalism It is well known from Noether's Theorem how from continuous symmetries in the Lagrangian one gets a conserved charge which corresponds to linear momentum, angular momentum for translational and rotational symmetries and others.  Is there any elementary argument for why linear or angular momentum specifically (and not other conserved quantities) are conserved which does not require knowledge of Lagrangians? By elementary I mean, "if this is not so, then this unreasonable thing occurs".   Of course, we can say "if we want our laws to be the same at a different point in space then linear conservation must be conserved", but can we derive mathematically the expression for the conserved quantity without using the Lagrangian?  I want to explain to a friend why they are conserved but he doesn't have the background to understand the Lagrangian formalism. A required field that isn't really required? ...the email field in my clients data entry system is required but users of the system are allowed to enter na@na.com if the customer refuses or doesn't have an email address. Is this best practice? Have any suggestions or workarounds for their solution? Does increasing voltage increase the torque of a brushless motor? 1.) I have a brushless motor with testing data at 12V. I want to know if I increase the voltage supply, will this increase the torque?   In my research I keep seeing "current controls torque, and voltage controls speed." But that doesn't seem quite right. Let's say I have a theoretical electrically powered unicycle that is weighted. With a 5V source and 2A, the motor can't move the unicycle. But now I increase the voltage to 10V, and I believe current will also increase by x2 if resistance is constant (V = IR). So now the torque increases and the unicycle can move itself. It that a reasonable sequence of events? Can I say that increasing voltage increases torque?   2.) A similar question: if P = VI = tau*omega, then P/omega = tau, so:  2*(P/omega) = 2*tau, which means increasing power will increase torque, correct? And since P = VI, increasing V will increase P, which will in turn increase torque. Is this accurate at all? I want to know by an example how prices in stock market changes Let us assume there is a listed company x. Currently it has 100 shares issued to trade in free float market. Current price of stock is let say 10. Now please let me know if I purchase one share of company x at the market price of 10. How it will effect the stock price. And please add and exemplify some other scenarios whichever you find good to explain more. For more information let say promoters of the company holds 100 shares with them like 50% of the company is with promoters and the other half is with people who invest or trade in that company. If I've missed to tell or assume any other vital info. needed please assume it yourself while mentioning it. Thank You What are recommended, general strategies to start block-cipher design and/or analysis? I (and many others for that matter) have always been fascinated by the inner workings of the modern building block of cryptography: block ciphers.  Now, the ressources on the "black art" of design and analysis of these ciphers are sparse; especially for the entry level. Available information like  seems to be somewhat outdated (due to its age).  What's the general consensus of the “best” (read: recommended) strategy to start designing and/or analyzing modern cryptographical block ciphers?    Nota bene: Think of this as a general, wiki-alike question – for learning purposes only. (Besides that, this Q&amp;A would represent a place we can point people to when alike algorithm design questions arise.) Can gravity be interpreted as the acceleration of spacetime towards an object? Greetings StackExchange!  We were having a conversation with a peer about stupid ways of interpreting theories. We would go to and fro with an interpretations, but we would always find a way to disprove them. There was one, however, that we couldn't refute:  Gravity on a plane in a bidimensional space can be interpreted as the acceleration of spacetime towards an object.   We tried to invalidate in saying that the inertial mass and gravitational mass would be different, thus violating GR, but after some thought this couldn't be. The gravitational mass would accelerate spacetime towards it. If that object we were to be pushed, the pulling of spacetime would make it difficult for it to move.   We know for a fact this can't be true, and we would greatly appreciate any refutation of this thought. I can clarify if needed, or do a sketch. I apologise in advance as I'm not a native speaker. How do I add Headers in List of Tables page? In today's pattern recognition class my professor talked about PCA, eigenvectors and eigenvalues.   I understood the mathematics of it. If I'm asked to find eigenvalues etc. I'll do it correctly like a machine. But I didn't understand it. I didn't get the purpose of it. I didn't get the feel of it.        I strongly believe in the following quote:     You do not really understand something unless you can explain it to your grandmother. -- Albert Einstein   Well, I can't explain these concepts to a layman or grandma.   Why PCA, eigenvectors &amp; eigenvalues? What was the need for these concepts? How would you explain these to a layman? I don't know so much about coordinate systems...  In my office we use to deal with spatial data coming from archaeological sites. Each site has its own x-y-z coordinate system (GCS). Three simple ortogonal cartesian axis. In the last years we have been managing this spatial data through GIS software (ArcGIS), without using specific coordinate system (just leave it as "undefined")  I'd like to know if there exisits any GCS designed to deal with such datasets using simple cartesian orthogonal axis, without grid distortions of the typical GCS. In addition, I'd like to know if this system is suitable for using it in an online mapping application.  By the way, we manage 2D (ArcMap) and 3D (ArcScene) environments and work with "mm" as length base unit.   If such a thing doesn't exists, maybe someone knows how to create it. Prove that for for all $p,q\in \mathbb{Z}$, $q&gt;0$ we have: $$ \left| \sqrt{2}-\frac{p}{q} \right| &gt; \frac{1}{3q^2}. $$  To be honest, I do not know where to start - any help would be appreciated. How to check if element is visible after scrolling? I'm loading elements via AJAX. Some of them are only visible if you scroll down the page. Is there any way I can know if an element is now in the visible part of the page? product of normal and lognormal variates If x and y are uncorrelated normal variates, x*exp(y) will have a symmetric unimodal distribution with positive excess kurtosis. Has this distribution been named and studied?