Java源码示例:it.unimi.dsi.fastutil.booleans.BooleanOpenHashSet

示例1
@SuppressWarnings("unchecked")
public static Set<?> toFastutilHashSet(Set<?> set, Type type, Metadata metadata)
{
    // 0.25 as the load factor is chosen because the argument set is assumed to be small (<10000),
    // and the return set is assumed to be read-heavy.
    // The performance of InCodeGenerator heavily depends on the load factor being small.
    Class<?> javaElementType = type.getJavaType();
    if (javaElementType == long.class) {
        return new LongOpenCustomHashSet((Collection<Long>) set, 0.25f, new LongStrategy(metadata, type));
    }
    if (javaElementType == double.class) {
        return new DoubleOpenCustomHashSet((Collection<Double>) set, 0.25f, new DoubleStrategy(metadata, type));
    }
    if (javaElementType == boolean.class) {
        return new BooleanOpenHashSet((Collection<Boolean>) set, 0.25f);
    }
    else if (!type.getJavaType().isPrimitive()) {
        return new ObjectOpenCustomHashSet<>(set, 0.25f, new ObjectStrategy(metadata, type));
    }
    else {
        throw new UnsupportedOperationException("Unsupported native type in set: " + type.getJavaType() + " with type " + type.getTypeSignature());
    }
}
 
示例2
public BooleanSet asSet() {
  BooleanSet set = new BooleanOpenHashSet(3);
  BooleanColumn unique = unique();
  for (int i = 0; i < unique.size(); i++) {
    set.add((boolean) unique.get(i));
  }
  return set;
}
 
示例3
public BooleanSet asSet() {
  BooleanSet set = new BooleanOpenHashSet(3);
  BooleanColumn unique = unique();
  for (int i = 0; i < unique.size(); i++) {
    set.add((boolean) unique.get(i));
  }
  return set;
}
 
示例4
public static boolean in(boolean booleanValue, BooleanOpenHashSet set)
{
    return set.contains(booleanValue);
}