KeyValueUtils { public static Map<String, String> filterWithKeyIgnoreCaseEndsWith(Properties properties, String suffix) { Map<String, String> keyValues = new HashMap<>(); for(String propertyName : properties.stringPropertyNames()) { keyValues.put(propertyName, properties.getProperty(propertyName)); } return filterWithKeyIgnoreCaseEndsWith(keyValues, suffix); }  static Map<String, String> filterWithKeyIgnoreCaseEndsWith(Properties properties, String suffix); static Map<String, String> filterWithKeyIgnoreCaseEndsWith(Map<String, String> keyValues, String suffix); static Map<String, String> removeKeySuffix(Map<String, String> keyValues, int suffixLength);  }
@Test public void testFilterWithKeyEndswith() { Map<String, String> map = new HashMap<>(); map.put("abc.met", "none"); map.put("abc_meta", "none"); map.put("2bc.meta", "none"); map.put("abc?met", "none"); Map<String, String> afterFilter = KeyValueUtils.filterWithKeyIgnoreCaseEndsWith(map, "_meta"); for(Map.Entry<String, String> entry : afterFilter.entrySet()) { String key = entry.getKey(); assertTrue(key.endsWith("_meta")); } }