取两个有规律字符串的交集,字符串的格式如下:

“[3095139,9080109]”

jar支持:

  fastjson

程序demo:

import com.alibaba.fastjson.JSON;
import java.util.List;
import java.util.stream.Collectors; public class JSONParseArray {
public static void main(String[] args){
JSONParseArrayTool();
}
public static void JSONParseArrayTool(){
List<Long> newIds = JSON.parseArray(("[3095139,9080109]"), Long.class);
List<Long> oldIds = JSON.parseArray(("[197868,197870]"), Long.class);
List<Long> missIds = oldIds.stream().filter(id -> !newIds.contains(id)).collect(Collectors.toList());
System.out.println(missIds);
} }

  

 
05-11 18:08