FormInputEnumUtils { public static LinkedHashMap<Object,String> extractKeyValue(String keyProperty,String valueProperty,Object... arrays) { if(arrays == null) return new LinkedHashMap(0); return extractKeyValue(keyProperty,valueProperty,Arrays.asList(arrays)); }  static LinkedHashMap<Object,String> toMap(FormInputEnum... arrays); static LinkedHashMap<Object,String> toMap(Collection<FormInputEnum> list); static LinkedHashMap<Object,String> extractKeyValue(String keyProperty,String valueProperty,Object... arrays); static LinkedHashMap<Object,String> extractKeyValue(String keyProperty,String valueProperty,List arrays);  }
@Test public void test_extractKeyValue() { Map map = FormInputEnumUtils.extractKeyValue("userid", "username", new RapidEnumUser("1","2"),new RapidEnumUser("2","2")); Assert.assertEquals(2,map.size()); Assert.assertTrue(map.containsKey("1")); Assert.assertTrue(map.containsKey("2")); Assert.assertTrue(map.containsValue("2")); }