兩個JSON對比

2021-10-25 08:01:56 字數 1401 閱讀 4790

需求:兩個json對比 目前有兩個json 型別的資料, 和 

* 對比出來的結構需要有,"2":,"3":,"4":,"5":}

class bo

public bo(string rowno, string name)

public string getrowno()

public void setrowno(string rowno)

public string getname()

public void setname(string name)

}public class test

listintersection = new arraylist();

string rowno;

for(bo b: newlist)

}// 這個時候能確定的是intersection 中的資料可以刪掉,剩下的就是比old 多 的

listcopynewlist = new arraylist<>();

copynewlist.addall(newlist);

listcopyoldlist = new arraylist<>();

copyoldlist.addall(oldlist);

// 刪除元素

listremovelist = new arraylist<>();

copynewlist.stream().foreach(vo ->

}});

copynewlist.removeall(removelist);

for(bo bo:copynewlist)

// 刪除元素

listtemplist = new arraylist<>();

copyoldlist.stream().foreach(vo ->

}});

copyoldlist.removeall(templist);

system.out.println(copyoldlist.size());

for(bo bo:copyoldlist)

// 兩邊相同行號的對比

for (string key : map.keyset()) }}

// 按照rowno 排序

comparatorcomparing = comparing((jsonobject a) -> a.getstring("rowno"));

sonlist.sort(comparing((jsonobject a) -> a.getstring("rowno")));

system.out.println(sonlist);

}public static void main(string args)

}

兩個檔案對比 C

public static bool filecompare string file1,string file2 int file1byte 0 int file2byte 0 using filestream fs1 new filestream file1,filemode.open fs2 n...

兩個問題的對比

問題1 cf390c 給定若干行聊天記錄 發言人 話 有些聊天記錄的 發言人 是缺失的,已知相鄰對話發言人一定不同,且每個發言人說的話裡都不會包含自己的名字,現給定可能的發言人的集合,請填充每個對話的發言人.來自codeforces round 390 問題2 lc36 給定乙個9 9的矩陣,有些元...

如何對比兩個Jar包

如果對比兩個jar包呢?jar 都是class 檔案,我對比jar,就是想知道,它增加了刪除了哪些方法。增加了哪些類,刪除了哪些類。有很多方法,你可以,反編譯,然後通過beyongcompair 去做。我這邊有乙個方法 1。首先電腦安裝perl 參考 3。解壓縮之後,執行 japi complian...