Here you can find the source of resolveCommandParam(List
public static double resolveCommandParam(List<String> params, String name, double defaultValue)
//package com.java2s; import java.util.List; import java.util.Map; public class Main { public static double resolveCommandParam(List<String> params, String name, double defaultValue) { String v = resolveCommandParam(params, name, null); return v == null ? defaultValue : Double.parseDouble(v); }/* w w w . ja v a2s .c om*/ public static int resolveCommandParam(List<String> params, String name, int defaultValue) { final String v = resolveCommandParam(params, name, null); return v == null ? defaultValue : Integer.parseInt(v); } public static String resolveCommandParam(List<String> params, String name, String defaultValue) { final int index = params.indexOf("-" + name); if (index < 0 || index == params.size() - 1) return defaultValue; return params.get(index + 1); } public static String resolveCommandParam(Map<String, ?> params, String name, String defaultValue) { final Object v = params.get(name); return v != null ? v.toString() : defaultValue; } public static int resolveCommandParam(Map<String, ?> params, String name, int defaultValue) { final String v = resolveCommandParam(params, name, null); return v == null ? defaultValue : Integer.parseInt(v); } }