a=[ { "user_id":"22b11db4-e907-4f1f-8835-b9daab6e1f23", "object_ids":[ "af86fa9e-65df-47f6-9c35-c3cd17ed8869", "39d159e4-1685-bfb3-3c8a-d82da3169e81" ] }, { "user_id":"39d155ed-da85-7cd5-eda0-1691e2515c6b", "object_ids":[ "af86fa9e-65df-47f6-9c35-c3cd17ed8869", "39d159e4-1685-bfb3-3c8a-d82da3169e81", "39d1512b-0959-ea02-7a83-2d2cece8fe7d" ] } ], b=["39d159e4-1685-bfb3-3c8a-d82abc69e81", "39d159e4-1685-bfb3-3c8a-d82da3169e99"]
大概是这样的两个字符串数组,检测b内元素(不会有重复元素)是否在a的object_ids里,每一个object_ids都要检查,object_ids内没有这个元素则a添加这个元素,a内有b内没有则a删除这个元素,难道要分别循环a,b?有什么好思路吗
代码:
一周热门 更多>