I have C# code that takes values of dictionary, sorts them and turns into list (using Linq). I would like to know how to do the same thing in Java (prefer most simple way).
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace Test
{
class Test
{
static void Main() {
Dictionary<string, string> wars = new Dictionary<string,string> () {
{"WWI","1914-1918"}, {"WWII","1939-1945"}, {"Vietnam War","1955-1975"}
};
var query=(from item in wars orderby item.Value descending select item.Value).ToList();
foreach (var i in query) {
Console.WriteLine (i);
}
}
}