Properties TreeMap and Stream
import java.io.FileOutputStream; import java.util.Map; import java.util.Properties; import java.util.TreeMap; public class List { public static void main(String args[]) throws Exception { Properties p = System.getProperties(); p.list(System.out); FileOutputStream fos = new FileOutputStream("sys.out"); p.store(fos, null); fos.close(); Map map = new TreeMap(p); System.out.println(map); } }