AbstractParameters extends AbstractMap<String, V> implements Parameters<V> { @Override public <T> List<T> getList(String key) { Object obj = get(key); if (obj instanceof List) { List list = (List)obj; return (List<T>)list; } else if (obj instanceof Object[]) { Object[] array = (Object[])obj; List<T> list = new ArrayList<>(array.length); for (Object anArray : array) { list.add((T)anArray); } return list; } else if (obj != null && obj.getClass().isArray()) { int len = Array.getLength(obj); List<T> list = new ArrayList<>(len); for (int i = 0; i < len; i++) { list.add((T)Array.get(obj, i)); } return list; } return null; }  String getString(String key); String getString(String key, String defValue); String[] getStringArray(String key); String[] getStringArray(String key, String[] defValue); boolean getBoolean(String key); boolean getBoolean(String key, boolean defValue); int getInt(String key); int getInt(String key, int defValue); int[] getIntArray(String key); int[] getIntArray(String key, int[] defValue); double getDouble(String key); double getDouble(String key, double defValue); long getLong(String key); long getLong(String key, long defValue); V get(String key, V defValue); Object[] getArray(String key); Object[] getArray(String key, Object[] defValue); static Parameters<V> toParameters(Map value); List<String> getStringList(String key); @Override List<T> getList(String key); Date getDate(String key); Date getDate(String key, Date defaultValue); T getEnum(Class<T> clazz, String key); T getEnum(Class<T> clazz, String key, T defaultValue); Map<String, V> toMap();  }
@Test public void getList() throws Exception { assertNull(parameters.getStringList("test")); ParametersMap map = new ParametersMap(); map.put("test1", new Object[] {"abc", "bcd"}); map.put("test2", "abc"); assertArrayEquals(map.getStringList("test1").toArray(), new String[] {"abc", "bcd"}); assertArrayEquals(map.getStringList("test2").toArray(), new String[] { "abc" }); }