I'm new to Java and is trying to learn the concept of Maps.   I have came up with the code below. However, I want to print out the "key String" and "value String" at the same time.   ProcessBuilder pb1 = new ProcessBuilder(); Map&lt;String, String&gt; mss1 = pb1.environment(); System.out.println(mss1.size());  for (String key: mss1.keySet()){     System.out.println(key); }   I could only find method that print only the "key String".
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?
Datasets constructed for a purpose similar to that of Anscombe's quartet I've just come across  (four datasets that have almost indistinguishable descriptive statistics but look very different when plotted) and I am curious if there are other more or less well-known datasets that have been created to demonstrate the importance of certain aspects of statistical analyses. Here is my script:  #!/bin/bash  echo "Digite o local em que deseja instalar o IGRAFU(pressione enter para  instalar em  ${HOME}/IGRAFO):" read caminho if test -z $caminho then caminho="${HOME}/IGRAFO" fi echo "O IGRAFU será instalado no diretório: $caminho" mkdir -pv $caminho  mv -v ./* $caminho echo "Pronto!"   At 'read caminho' I may receive from the user a path like ~/somefolder. When the script receives that kind of path both mv and mkdir won't make tilde expansion, so it will try to create a ~/somefolder and not /home/username/somefolder and therefore fail.  How do I ensure that the tilde will be converted into the HOME variable? I have a file, which was encrypted with AES-128 in ECB mode. I know the format of the original file and know that all files in this format have the same headers. So, I have an encrypted block and the original block.  Can I get the encryption key, using this information? We all know you can't do the following because of ConcurrentModificationException:  for (Object i : l) {     if (condition(i)) {         l.remove(i);     } }   But this apparently works sometimes, but not always. Here's some specific code:  public static void main(String[] args) {     Collection&lt;Integer&gt; l = new ArrayList&lt;&gt;();      for (int i = 0; i &lt; 10; ++i) {         l.add(4);         l.add(5);         l.add(6);     }      for (int i : l) {         if (i == 5) {             l.remove(i);         }     }      System.out.println(l); }   This, of course, results in:  Exception in thread "main" java.util.ConcurrentModificationException   Even though multiple threads aren't doing it. Anyway.  What's the best solution to this problem? How can I remove an item from the collection in a loop without throwing this exception?  I'm also using an arbitrary Collection here, not necessarily an ArrayList, so you can't rely on get. I need a quick algorithm to select 5 random elements from a generic list. For example, I'd like to get 5 random elements from a List&lt;string&gt;. How to change the date format? Presently the date is showing as mmm dd hh:mm:ss. Is there any way that I can change it to as per my liking. For example : dd mmm, hh:mm:ss. Given fields $K\subseteq L$, why does $f,g$ relatively prime in $K[x]$ imply relatively prime in $L[x]$? Conflict between tkz-fct and thmtools? Blender 2.8 contains a number of HDRi's in it by default for the LookDev. I'd like to know how to use them in final renders (EEVEE or Cycles), because quite frankly they appear fantastic. Clearly if $\lambda$ is an eigenvalue of $A$ then $p(\lambda)$ is an eigenvalue of $p(A)$ where $p$ is a polynomial. And there are cases where $A$ may have eigenvalues other than these.   Is there a general rule for finding all eigenvalues of $p(A)$? Does it depend on the field from which the elements of $A$ are taken? Are their any partial solutions to this problem? No feedback when comment fails to post on Android 2.3.5 In the mobile theme on Android 2.3.5, comments that do not meet the minimum length will fail to post but no feedback message is displayed to the user.  The submit button changes to its active state, but nothing else happens. I have a PHP script that can encode a PNG image to a Base64 string.  I'd like to do the same thing using JavaScript. I know how to open files, but I'm not sure how to do the encoding. I'm not used to working with binary data. The electroweak and strong forces seem to be completely different types of forces to gravity. The latter is geometric while the former are not (as far as I'm aware!). So why should they all be described in the same way? - Why are gravitons needed?  Alternatively, I suppose my question is why a theory of everything has to be some form of quantum gravity. Is there a reason why a theory of everything requires gravity to be quantised? Is it possible for the quantum world and gravity to be described by some overarching theory which does not require gravity to be quantised? Or is there some reason why this is not the case? Partial Fraction Decomposition? I've found several answers on switching between an Adapter and a Battery. But I need to autmoatically switch between two batteries. One of them is 'hotplugable'.  Problem: I've got a Solarcell which charges a ~16000mAh Li-Ion battery (BATa). Once in a while, the Solarcell doesn't manage to charge the battery enough. It's crucial that I have 3.0 to 4.1 Volts on my VSYS but the voltage will drop below this value if the Solarcell wasn't able to do its job (cloudy weather, vulcano eruption [joke], dirty cells, etc).  My Plan: I've come up with the idea to feed the VSYS with a additional, hotplugable backup battery (BATb) which does get connected to VSYS if BATa drops below ~3.1v.  So basically I need a Low-Voltage-Cutoff (using a Z-Diode with a Mosfet?) which, when cutoff happens, opens another Mosfet..?         &ndash; Schematic created using   I'm not sure about the selection of M2 and how to wire it, so it will be conductive if M1 won't forward power anymore.  And I know about another electrical problem: Just using a Z-Diode (D1) with M1 will render M1 to something like a resistor, not a switch. I've read, that I could use something like a Shut Reference (i.e. TI's TL43xx). Again I'm not sure how to chose the correct one and how to wire it. Path bar missing in file dialog after running software updater for Ubuntu 17.04 After running software updater, the path bar in the file dialog (for example the one you get when choosing Open File in in Google Chrome or Firefox) is missing. This is frustrating since it's no longer possible to copy a path from the terminal (for example) and paste it into the file dialog. Here is a screenshot of the dialog:     How can I get back the path bar? It seems that I'm missing something about this.  First of all, the series is convergent: $\lim_{n\rightarrow\infty}\frac{2^{-n-1} (n+1)^2}{2^{-n} n^2}=\frac{1}{2}$ (ratio test)  What I tried to do is to find a limit of a partial sum $\lim_{n\rightarrow\infty}S_n$ as follows: $S_n=\frac{\frac{1}{6} n (n+1) (2 n+1)}{\frac{1-\left(\frac{1}{2}\right)^n}{2 \left(1-\frac{1}{2}\right)}}$. Still, the limit is $\infty$ and I'm clearly doing something wrong. Functions that are their own inverse. What are the functions that are their own inverse?  (thus functions where $ f(f(x)) = x $ for a large domain)  I always thought there were only 4:  $f(x) = x , f(x) = -x , f(x) = \frac {1}{x} $ and $ f(x) = \frac {-1}{x} $   Later I heard about a fifth one     $$f(x) = \ln\left(\frac {e^x+1}{e^x-1}\right) $$ (for $x &gt; 0$)  This made me wonder are there more? What are conditions that apply to all these functions to get more, etc. Deleting a channel on slack.com Showing that a function is a tensor I am trying to solve question 4 in Munkres Analysis on Manifolds section 26.  The question is determine if the following is a tensor on $\mathbb{R}^4$ and express those that are in terms of the elementary tensors on $\mathbb{R}^4$.   $f(x,y) = 3 x_1 y_2 + 5 x_2 x_3$   I am trying to follow the definition of a tensor (which I don't think I fully understand) to show this. I know I must find a function $T: \mathbb{R}^4 \rightarrow \mathbb{R}$ that is linear on the $i^{th}$ variable. Since there are only 2, then I believe I have to somehow write $f$ as a projection. I'm just not sure where to  go from here.  Any hints would be great, thanks!