Sort Map By Value Object Member I have a generic Map which is defined thus  Map&lt;Integer, Book&gt; bookCollection   The Integer is the book ID and the Book is obviously a Book object. The Book object has a member called publicationYear.   How do I sort the Map so that its Book objects are in order by the Book's publicationYear member. So, if I iterate through the sorted map, the oldest book appears first up to the newest book.  At the moment, the Map is randomly sorted.
Sort a Map by values I am relatively new to Java, and often find that I need to sort a Map&lt;Key, Value&gt; on the values.  Since the values are not unique, I find myself converting the keySet into an array, and sorting that array through array sort with a custom comparator that sorts on the value associated with the key.  Is there an easier way?
What are the system requirements for each flavour of Ubuntu Desktop? I'm thinking about installing Ubuntu Desktop, but I don't know what flavor is the best for my system. What are the minimum and recommended hardware requirements? What kind of CPU? How much memory? Should I have Hardware Acceleration? What flavor should I use?  This is an attempt of a canonical answer. My answers have the &quot;official  requirements&quot;, the recommended are a mix of official sources and opinion based (along with the answer it's told the source). You can comment or edit if you feel that the information is obsolete or incomplete. It is a good rule of thumb that any system capable of running Windows Vista, 7, 8, x86 (Intel) OS X will almost always be a lot faster with any Ubuntu flavor even if they are lower-spec than described below. Usage of "would" and "will" Using subcaption package but subfigures end up stacked rather than side by side I'm trying to put two jpegs side by side using the subcaption package, but the images are consistently stacking on top of each other rather than side by side. All the solutions I've found simply state that the pictures have to be small enough to actually be side by side but I've tried making them smaller, too small even and they stay stacked. My code looks like this:  \begin{figure}[H] \centering \begin{subfigure}{0.5\textwidth} \centering     \includegraphics[width=0.3\linewidth]{inclusion.jpg}     \caption{inclusions}     \label{fig:inclu} \end{subfigure}  \begin{subfigure}{0.5\textwidth} \centering     \includegraphics[width=0.3\linewidth]{deform}     \caption{grain deformation}     \label{fig:deform} \end{subfigure} \caption{filler text} \label{fig:manmade} \end{figure}   Help would be greatly appreciated. I use multiple displays, and the available options for Spaces that I am aware of allow surprise Space-switching, even when working in a completely different space.  Ideally, interacting with the Dock will only affect the same Space on the same display on which I used the Dock. This means:   If app clicked in Dock, and no copy of app is running on any space, then start the app and confine it to the current Space. If app clicked in Dock, and the program is already running in another Space, then either 1) open a new window if the program allows this, or 2) silently move the app to the current Space without disturbing or changing any other Space or display. If app clicked in Dock, and the program is already running in the current Space, then change focus to the app.   Specifically: - Clicking an icon in the Dock should rarely affect any other Space. - Clicking an icon in the Dock must never affect which Space is displayed on which display  OS X Yosemite 10.10.2, MacBook Pro 2012. (Dock set to auto-hide, and pops up at the bottom of any screen when I put the mouse there.) Characterize the groups $G$ for which the map $\iota: G \to G$, sending $x \mapsto x^{-1}$ for all $x \in G$, is an automorphism of $G$ I have trouble on this question: "Characterize the groups G for which the map $$\iota: G \to G$$ sending $$x \mapsto x^{-1}$$ for all $x \in G$, is an automorphism of $G$." From  post I have seen that $G$ must be abelian. Can anyone propose another characteristic of $G$ that I can derive from the given conditions besides abelian? Thank you so much!! What are the basis for co-countable and co-finite topologies How to use hook_node_presave to change field's value Conjugacy classes in $A_n$. Suppose $n$ is a non negative integer $\geq 4$ and $\sigma\in S_n$ a permutation. Conjugacy classes in $S_n$ are completley determined by the cycle structure of $\sigma$. If we let the alternating group $A_n$.act on $S_n$ by conjugation, the orbits coincide with the conjugacy classes in $S_n$ except for those (even) permutations whose cycle structure is composed of even cycles (which corresponds to cycles of uneven length) of distinct order (fixed points are treated as cycles of length $1$.) See   For instance a $3$-cycle in $A_4$ has cycle structure $[3,1]$ which fits the bill, and a $5$-cycle in $A_5$ or $A_6$ works too, since the cycle structure is $[5]$ and $[5,1]$ respectively. On the other hand, a $3$-cycle in $A_5$ will does not satisfy the criteria as it has cycle structure $[3,1,1]$ with two fixed points.  In this case, the conjugacy class of $\sigma$ inside $S_n$ splits in $2$ orbits of the conjugation action of $A_n$, and if $\tau$ is any odd permutation, for instance $(12)$, then we have $$\mathrm{Conj}_{S_n}(\sigma)=\mathcal{O}(\sigma)\coprod\mathcal{O}(\tau\sigma\tau^{-1})$$  My question is How can we differentiate between the two orbits? Does it have geometric meaning?    I can see that this information can be useful when looking at representations of the alternating groups, since there are as many irreducible representations as conjugacy classes. As for some geometric interpretation, I ask because there is one for the three cycles in $A_4$. If $S_4$ is understood as the group of symmetries of a regular tetrahedron, then $A_4$ is the subgroup of direct symmetries, and a $3$-cycle corresponds to a rotation of angle $\frac{2\pi}{3}$ or $\frac{4\pi}{3}$ with axis passing through one of the vertices. Conjugacy classes inside $A_n$ preserve the angle, and that's how we can tell them apart. In this case the computations are so simple we don't really need this picture, but I think it is a nice way to understand the fact $3$-cycles in are not all conjugate inside $A_4$... A Variation of the even-town odd-town problem How to create a list template by using CSOM? is a plug-in to display informational and beautiful statusline for vim, tmux and shell prompt for bash, zsh.  Vim statusline:     How can I install and setup Powerline for different applications and shells in Ubuntu? In the answer to , I was advised:      Yes you have to download the language pack. And you also have to go here: C:\Program Files (x86)\Origin Games\Dragon Age Inquisition\Data\Win32        In the folder loctext leave only the files en.sb and en.toc present, put the others in a folder named temp.   In the folder locfacefx make a copy of en.sb_DiP_STAGED and en.toc_DiP_STAGED, rename them to en.sb and en.toc. place the other language files into a temp folder   When I started the game the language was changed also into the interface. Take notes on what you have done and keep the original files in case something doesn't work, but for the moment that seem to work."   I have no en.sb_DiP_STAGED and en.toc_DiP_STAGED files in my Origin version of the game. Let $R$ be a commutative Noetherian ring (with unity), and let $I$ be an ideal of $R$ such that $R/I \cong R$. Then is it true that $I=(0)$ ?  I know that a surjective ring endomorphism of a Noetherian ring is also injective, and since there is a natural surjection from $R$ onto $R/I$ we get a surjection from $R$ onto $R$, but the problem is I can not determine the map explicitly and I am not sure about the statement. Please help. Thanks in advance. How do I develop black and white negatives at home? Why don't we define "imaginary" numbers for every "impossibility"? SF Story about human adapting to alien environment How do I figure out who's been banished to the penalty box recently? Basis of the null space Find the basis of the null space for the matrix  $$D = \begin{bmatrix}0 &amp; 0 &amp; 0 &amp; 0\\0 &amp; 1 &amp; 1 &amp; 0\\1 &amp; 1 &amp; 0 &amp; 0\\1 &amp;1 &amp; 0 &amp; 0\end{bmatrix}.$$  I computed the solution by letting eigenvectors $(x,y,z,w)$ such that $y+z=0,x+y=0$, and I got a basis vector $\{(1,-1,1,0), (0,0,0,1)\}$ . But from one textbook  I have found the solution as $\{(1,0,0,0),(0,0,1,1)\}$. May I made a mistake? Thanks! Why is my variable local in one 'while read' loop, but not in another seemingly similar loop? Why do I get different values for $x from the snippets below?  #!/bin/bash  x=1 echo fred &gt; junk ; while read var ; do x=55 ; done &lt; junk echo x=$x  #    x=55 .. I'd expect this result  x=1 cat junk | while read var ; do x=55 ; done echo x=$x  #    x=1 .. but why?  x=1 echo fred | while read var ; do x=55 ; done echo x=$x  #    x=1  .. but why? Prove that $\frac4{abcd} \geq \frac a b + \frac bc + \frac cd +\frac d a$ Let $a, b, c$ and $d$ be positive real numbers such that $a+b+c+d = 4$. Prove that $$\frac4{abcd} \geq \frac a b + \frac bc + \frac cd +\frac d a .$$   How can I approach this using only the ? Are there any other methods that do not involve the AM-GM inequality?