多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
[TOC] # 简介 特点:无序,无重复元素 # 命令行 ![](https://box.kancloud.cn/71a9f0a2f10c66a0775b8a30f4857c7c_707x963.png) ![](https://box.kancloud.cn/68a8a988d7a3f7137e62cd9ef0a7e224_668x855.png) # 代码 ~~~ Jedis jedis = init(); jedis.sadd("friends:1", "dandan", "lulu", "lili"); jedis.sadd("friends:2","laowang","laodu","laoli","lili"); //判断一个成员是否属于指定的集合 Boolean isornot = jedis.sismember("friends:1","laowang"); System.out.println(isornot); //求2个集合的差并交集 Set<String> sdiff = jedis.sdiff("friends:1", "friends:2"); Set<String> sunion = jedis.sunion("friends:1", "friends:2"); Set<String> sinter = jedis.sinter("friends:1", "friends:2"); //打印结果 System.out.println("---差集---"); for (String sd: sdiff) { System.out.println(sd); } System.out.println("---并集---"); for (String su: sunion) { System.out.println(su); } System.out.println("---交集---"); for (String si: sinter) { System.out.println(si); } ~~~