private void populateBoyersList() { Map<String, String> parseSimpleArrayAsMap = ConfigUtil.parseSimpleArrayAsMap(serviceName + ".http.monitoringFilter.baseUri"); List<String> keys = new ArrayList<String>(parseSimpleArrayAsMap.keySet()); // Collections.sort(keys); Collections.sort(keys, new Comparator<String>() { // Overriding the compare method to sort the age public int compare(String str1, String str2) { return Integer.parseInt(str1) - Integer.parseInt(str2); } }); for (String key : keys) { String baseUri = parseSimpleArrayAsMap.get(key); boyers.add(new BoyerMoore(baseUri)); } }
private List<BoyerMoore> populateBoyersList() { List<BoyerMoore> boyers = new ArrayList<BoyerMoore>(); Map<String, String> parseSimpleArrayAsMap = ConfigUtil.parseSimpleArrayAsMap(configuration, apiName + ".http.monitoringBaseUri"); List<String> keys = new ArrayList<String>(parseSimpleArrayAsMap.keySet()); // Collections.sort(keys); Collections.sort(keys, new Comparator<String>() { // Overriding the compare method to sort the age public int compare(String str1, String str2) { return Integer.parseInt(str1) - Integer.parseInt(str2); } }); for (String key : keys) { String baseUri = parseSimpleArrayAsMap.get(key); boyers.add(new BoyerMoore(baseUri)); } return boyers; }
/** * parse an simple array and return it as a Map. Can be used in conjunction with {@code ConfigUtil#parseComplexArrayStructure(String)} * @param configPrefix the prefix that is the basis of the array. E.g. * * given: * * smartcardAdaptor.cardFeatures.23.sbmMSB.0=0x00 * smartcardAdaptor.cardFeatures.23.sbmMSB.1=0x01 * * the config prefix will be: * smartcardAdaptor.cardFeatures.23.sbmMSB * * @return the Map where the index is the key and the value is the value. */ public static Map<String, String> parseSimpleArrayAsMap(String configPrefix) { Configuration configuration = ConfigurationFactory.getConfiguration(); return parseSimpleArrayAsMap(configuration, configPrefix); }