本文整理汇总了Java中com.gs.collections.impl.set.mutable.primitive.IntHashSet.clear方法的典型用法代码示例。如果您正苦于以下问题:Java IntHashSet.clear方法的具体用法?Java IntHashSet.clear怎么用?Java IntHashSet.clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.gs.collections.impl.set.mutable.primitive.IntHashSet
的用法示例。
在下文中一共展示了IntHashSet.clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: xtestHashCombineUniqueness
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入方法依赖的package包/类
public void xtestHashCombineUniqueness()
{
final int MAX_COUNT = 2000;
int[] first = new int[MAX_COUNT];
int[] second = new int[MAX_COUNT];
IntHashSet unique = new IntHashSet(MAX_COUNT);
Random rand = new Random(167776191048573L);
for(int i=0;i<MAX_COUNT;i++)
{
// first[i] = rand.nextInt();
first[i] = i;
}
for(int i=0;i<MAX_COUNT;i++)
{
// second[i] = rand.nextInt();
second[i] = i+MAX_COUNT;
}
for(int i=0;i<MAX_COUNT;i++)
{
for(int j=0;j<MAX_COUNT;j++)
{
unique.add((HashUtil.combineHashes(first[i], second[j])& 0x7fffffff) % 4591721);
}
}
System.out.println("combineHash uniqueness "+unique.size());
unique.clear();
for(int i=0;i<MAX_COUNT;i++)
{
for(int j=0;j<MAX_COUNT;j++)
{
unique.add((HashUtil.combineHashesOld(first[i], second[j])& 0x7fffffff) % 4591721);
}
}
System.out.println("combineHashOld uniqueness "+unique.size());
unique.clear();
for(int i=0;i<MAX_COUNT;i++)
{
for(int j=0;j<MAX_COUNT;j++)
{
unique.add((HashUtil.combineHashesHsieh(first[i], second[j])& 0x7fffffff) % 4591721);
}
}
System.out.println("combineHashesHsieh uniqueness "+unique.size());
unique.clear();
for(int i=0;i<MAX_COUNT;i++)
{
for(int j=0;j<MAX_COUNT;j++)
{
unique.add((HashUtil.combineHashesMurmur(first[i], second[j])& 0x7fffffff) % 4591721);
}
}
System.out.println("combineHashesMurmur uniqueness "+unique.size());
unique.clear();
for(int i=0;i<MAX_COUNT;i++)
{
for(int j=0;j<MAX_COUNT;j++)
{
unique.add((HashUtil.combineHashesBad(first[i], second[j])& 0x7fffffff) % 4591721);
}
}
System.out.println("combineHashBad uniqueness "+unique.size());
unique.clear();
}
示例2: xtestHashCombineUniqueness3
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入方法依赖的package包/类
public void xtestHashCombineUniqueness3()
{
final int MAX_COUNT = 2000;
int[] first = new int[MAX_COUNT];
int[] second = new int[MAX_COUNT];
IntHashSet unique = new IntHashSet(MAX_COUNT);
Random rand = new Random(167776191048573L);
for(int i=0;i<MAX_COUNT;i++)
{
// first[i] = rand.nextInt();
first[i] = i;
}
for(int i=0;i<MAX_COUNT;i++)
{
// second[i] = rand.nextInt();
second[i] = i+MAX_COUNT;
}
for(int i=0;i<MAX_COUNT;i++)
{
for(int j=0;j<MAX_COUNT;j++)
{
unique.add(HashUtil.combineHashes(first[i], second[j]) & ((1 << 16) - 1));
}
}
System.out.println("combineHash uniqueness "+unique.size());
unique.clear();
for(int i=0;i<MAX_COUNT;i++)
{
for(int j=0;j<MAX_COUNT;j++)
{
unique.add(HashUtil.combineHashesOld(first[i], second[j]) & ((1 << 16) - 1));
}
}
System.out.println("combineHashOld uniqueness "+unique.size());
unique.clear();
for(int i=0;i<MAX_COUNT;i++)
{
for(int j=0;j<MAX_COUNT;j++)
{
unique.add(HashUtil.combineHashesHsieh(first[i], second[j]) & ((1 << 16) - 1));
}
}
System.out.println("combineHashesHsieh uniqueness "+unique.size());
unique.clear();
for(int i=0;i<MAX_COUNT;i++)
{
for(int j=0;j<MAX_COUNT;j++)
{
unique.add(HashUtil.combineHashesMurmur(first[i], second[j]) & ((1 << 16) - 1));
}
}
System.out.println("combineHashesMurmur uniqueness "+unique.size());
unique.clear();
for(int i=0;i<MAX_COUNT;i++)
{
for(int j=0;j<MAX_COUNT;j++)
{
unique.add(HashUtil.combineHashesBad(first[i], second[j]) & ((1 << 16) - 1));
}
}
System.out.println("combineHashBad uniqueness "+unique.size());
unique.clear();
}
示例3: xtestHashCombineUniqueness2
import com.gs.collections.impl.set.mutable.primitive.IntHashSet; //导入方法依赖的package包/类
public void xtestHashCombineUniqueness2()
{
final int MAX_COUNT = 10000;
IntHashSet unique = new IntHashSet(MAX_COUNT);
for(int j=0;j<MAX_COUNT;j++)
{
unique.add((HashUtil.combineHashes(j, 0) & ((1 << 16) - 1)));
}
System.out.println("combineHash uniqueness "+unique.size());
unique.clear();
for(int j=0;j<MAX_COUNT;j++)
{
unique.add((HashUtil.combineHashesOld(j, 0) & ((1 << 16) - 1)));
}
System.out.println("combineHashOld uniqueness "+unique.size());
unique.clear();
for(int j=0;j<MAX_COUNT;j++)
{
unique.add((HashUtil.combineHashesHsieh(j, 0) & ((1 << 16) - 1)));
}
System.out.println("combineHashesHsieh uniqueness "+unique.size());
unique.clear();
for(int j=0;j<MAX_COUNT;j++)
{
unique.add((HashUtil.combineHashesBad(j, 0) & ((1 << 16) - 1)));
}
System.out.println("combineHashBad uniqueness "+unique.size());
unique.clear();
for(int j=0;j<MAX_COUNT;j++)
{
unique.add((HashUtil.combineHashesMurmur(j, 1) & ((1 << 16) - 1)));
}
System.out.println("combineHashesMurmur uniqueness "+unique.size());
unique.clear();
}