温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

URL去重该如何实现

发布时间:2021-12-31 17:30:25 来源:亿速云 阅读:126 作者:柒染 栏目:编程语言

URL去重该如何实现,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。

URL去重该如何实现

URL去重该如何实现

URL去重该如何实现

URL去重该如何实现

IPv6编码地址数:2^128(约3.4×10^38)

IPv6是IETF设计的用于替代现行版本IP协议(IPv4)的下一代IP协议,号称可以为全世界的每一粒沙子编上一个网址。

URL去重该如何实现

URL去重该如何实现

URL去重该如何实现

public <T> boolean put(T object, Funnel<? super T> funnel, int numHashFunctions, BitArray bits) {      long bitSize = bits.bitSize();      long hash74 = Hashing.murmur3_128().hashObject(object, funnel).asLong();      int hash2 = (int) hash74;      int hash3 = (int) (hash74 >>> 32);        boolean bitsChanged = false;      for (int i = 1; i <= numHashFunctions; i++) {          int combinedHash = hash2 + (i * hash3);          // Flip all the bits if it's negative (guaranteed positive number)          if (combinedHash < 0) {              combinedHash = ~combinedHash;          }          bitsChanged |= bits.set(combinedHash % bitSize);      }      return bitsChanged;  }

URL去重该如何实现

boolean set(long index) {       if (!get(index)) {           data[(int) (index >>> 6)] |= (1L << index);           bitCount++;           return true;       }       return false;   }       boolean get(long index) {       return (data[(int) (index >>> 6)] & (1L << index)) != 0;   }

02 先get()一下,看看是不是已经置为1。

03 index右移6位就是除以64,说明data是long型的数组,除以64就定位到了bit所在的数组下标。1L左移index位,定位到了bit在long中的位置。

看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注亿速云行业资讯频道,感谢您对亿速云的支持。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

url
AI