手把手教你写网络爬虫(7):URL去重
本系列:
- 《手把手教你写网络爬虫(1):网易云音乐歌单》
- 《手把手教你写网络爬虫(2):迷你爬虫架构》
- 《手把手教你写网络爬虫(3):开源爬虫框架对比》
- 《手把手教你写网络爬虫(4):Scrapy入门》
- 《手把手教你写网络爬虫(5):PhantomJS实战》
- 《手把手教你写网络爬虫(6):分布式爬虫》





IPv6编码地址数:2^128(约3.4×10^38)
IPv6是IETF设计的用于替代现行版本IP协议(IPv4)的下一代IP协议,号称可以为全世界的每一粒沙子编上一个网址。



public <T> boolean put(T object, Funnel<? super T> funnel, int numHashFunctions, BitArray bits) {
long bitSize = bits.bitSize();
long hash64 = Hashing.murmur3_128().hashObject(object, funnel).asLong();
int hash1 = (int) hash64;
int hash2 = (int) (hash64 >>> 32);
boolean bitsChanged = false;
for (int i = 1; i <= numHashFunctions; i++) {
int combinedHash = hash1 + (i * hash2);
// Flip all the bits if it's negative (guaranteed positive number)
if (combinedHash < 0) {
combinedHash = ~combinedHash;
}
bitsChanged |= bits.set(combinedHash % bitSize);
}
return bitsChanged;
} 
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;
} 相关推荐
我欲疾风前行 2020-06-18
CycloneKid 2020-10-27
jling 2020-09-17
fengling 2020-08-15
我欲疾风前行 2020-06-04
athrenzala 2020-05-30
zengni 2020-05-29
sunzhihaofuture 2020-05-17
hilary0 2020-05-15
hilary0 2020-05-04
hilary0 2020-05-03
fangjack 2020-04-22
knightwatch 2020-04-16
宿舍 2020-03-06
四叶草 2020-02-15
oXiaoChong 2020-02-14
四叶草 2020-01-30