/ Published in: Java
input: -width 123 -height 234 -minimized -visible output map: {"-width":"123", "-height":"234", "-minimized":null, "-visible":null}
Expand |
Embed | Plain Text
{ // parse arguments Map<String, String> params = new HashMap<String, String>(); for (int i = 0; i < args.length; i++) { assert (k.startsWith("-")); // see if there's a value following int j = i + 1; if (j < args.length) { if (!_v.startsWith("-")) { v = _v; i++; } } params.put(k, v); } }
You need to login to post a comment.
