我正在使用yamlbeans从yaml文件中获取数据。我得到了以下回复 {x1 = [{y1 = z1},{y2 = z2}],x2 = [{y1 = z1},{y2 = z2]}
现在我想得到x1的数据y1,但我无法做到这一点。我正在使用以下代码进行读取操作
package com.mobileapp;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import net.sourceforge.yamlbeans.YamlReader;
public class ReadDataWithYaml {
public static void main(String[] args) {
try {
YamlReader reader = new YamlReader(new FileReader("C:\\Users\\5521\\Desktop\\test.yml"));
Object object = reader.read();
System.out.println(object);
Map<String, ArrayList<String>> map = (Map<String, ArrayList<String>>) object;
System.out.println(map.get("x1"));
} catch (Exception exception) {
exception.printStackTrace();
}
}
}
答案 0 :(得分:0)
ThreadContext.put("something", "CHANGE");