/** * Construct a new instance. The given values are used as the string members in the order they are given. * * @param values the values * @return the string enumeration */ public static StringEnumeration of(String... values) { final int length = values.length; Data[] byId = new Data[length]; HashMap<String, Data> index = new HashMap<>(length); String str; for (int i = 0; i < length; i ++) { str = Assert.checkNotNullArrayParam("values", i, values[i]); index.put(str, byId[i] = new Data(i, str)); } return new StringEnumeration(index, byId); }
/** * Construct a new instance. The given values are used as the string members in the order they are given. * * @param values the values * @return the string enumeration */ public static StringEnumeration of(String... values) { final int length = values.length; Data[] byId = new Data[length]; HashMap<String, Data> index = new HashMap<>(length); String str; for (int i = 0; i < length; i ++) { str = Assert.checkNotNullArrayParam("values", i, values[i]); index.put(str, byId[i] = new Data(i, str)); } return new StringEnumeration(index, byId); }
/** * Construct a new instance. The given values are used as the string members in the order they are given. * * @param values the values * @return the string enumeration */ public static StringEnumeration of(String... values) { final int length = values.length; Data[] byId = new Data[length]; HashMap<String, Data> index = new HashMap<>(length); String str; for (int i = 0; i < length; i ++) { str = Assert.checkNotNullArrayParam("values", i, values[i]); index.put(str, byId[i] = new Data(i, str)); } return new StringEnumeration(index, byId); }
/** * Construct a new instance. The given values are used as the string members in the order they are given. * * @param values the values * @return the string enumeration */ public static StringEnumeration of(String... values) { final int length = values.length; Data[] byId = new Data[length]; HashMap<String, Data> index = new HashMap<>(length); String str; for (int i = 0; i < length; i ++) { str = Assert.checkNotNullArrayParam("values", i, values[i]); index.put(str, byId[i] = new Data(i, str)); } return new StringEnumeration(index, byId); }