我有2个地图对象(一个是初始状态和一个来自网络),我需要将初始状态与从网络接收的数据合并。但是,我保持 public void ReadPDF() throws Exception {
URL TestURL = new URL("http://www.axmag.com/download/pdfurl-guide.pdf");
BufferedInputStream TestFile = new BufferedInputStream(TestURL.openStream());
PDFParser TestPDF = new PDFParser(TestFile);
TestPDF.parse();
String TestText = new PDFTextStripper().getText(TestPDF.getPDDocument());
Assert.assertTrue(TestText.contains("Open the setting.xml, you can see it is like this"));
}
来处理客户端的状态以及服务器端的其他状态。
"hideDetails": true
我想合并这两个并获得如下的新状态,
//initial state
var j = Immutable.fromJS({
"staffs": {
"hasRecievedData": false,
"addingNewStaff": false,
"data": {
"0": {
"name" : null,
"age" : null,
"designation" : null,
"email" : null,
"hideDetails": true
}
}
}
});
// data from network
var m = Immutable.fromJS({
"staffs" : {
"0" : {
"name" : "name1",
"age" : "23",
"designation" : "work1",
"email" : "aliasson@abcd.com"
},
"1" : {
"name" : "name2",
"age" : "22",
"designation" : "work2",
"email" : "aliassson@abcd.com"
}
}
});
如何使用合并功能实现它?
UPDATE1:
不确定这是否正确,但我得到了结果,
var m = Immutable.fromJS({
"staffs" : {
"hasRecievedData": false,
"addingNewStaff": false,
"0" : {
"name" : "name1",
"age" : "23",
"designation" : "work1",
"email" : "aliasson@abcd.com",
"hideDetails": true
},
"1" : {
"name" : "name2",
"age" : "22",
"designation" : "work2",
"email" : "aliassson@abcd.com",
"hideDetails": true
}
}
});
答案 0 :(得分:0)
来自ImmutableJS docs:
ContentProvider