### Question:
YamlUtil { public static LinkedHashMap<String, String> getYmlByFileName(String filename) throws FileNotFoundException { result = new LinkedHashMap<String, String>(); if (filename == null) { filename = YAMLFILE; } File file = new File(filename); FileInputStream fis = new FileInputStream(file); Yaml props = new Yaml(); Map<String, Object> param = props.loadAs(fis, Map.class); for (Map.Entry<String, Object> entry:param.entrySet()) { String key = entry.getKey(); Object val = entry.getValue(); if (val instanceof Map) { forEachYaml(key, (Map<String, Object>) val); } else { result.put(key, val.toString()); } } return result; }  final static String key(String key); static List<LinkedHashMap<String, String>> getYmlByFileNamePerfect(String filename); static LinkedHashMap<String, String> getYmlByFileName(String filename); static Map<String, String> forEachYaml(String key_str, Map<String, Object> obj); static String getValue(String filename, String key); static StringWriter dump(Object obj); static StringWriter dumpAll(List list);  }### Answer:
@Test public void getYmlByFileName() throws FileNotFoundException { LinkedHashMap<String, String> map = yamlUtil.getYmlByFileName("E:/configserver-application-0.1.0.0.yaml"); Iterator<Map.Entry<String, String>> iterator = map.entrySet().iterator(); while(iterator.hasNext()) { Map.Entry<String, String> next = iterator.next(); System.out.println(next.getKey()+"================="+next.getValue()); } }