@SuppressWarnings("unchecked") public static Set<?> toFastutilHashSet(Set<?> set, Type type, FunctionRegistry registry) { // 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(registry, type)); } if (javaElementType == double.class) { return new DoubleOpenCustomHashSet((Collection<Double>) set, 0.25f, new DoubleStrategy(registry, 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(registry, type)); } else { throw new UnsupportedOperationException("Unsupported native type in set: " + type.getJavaType() + " with type " + type.getTypeSignature()); } }
@SuppressWarnings("unchecked") public static Set<?> toFastutilHashSet(Set<?> set, Type type, FunctionRegistry registry) { // 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(registry, type)); } if (javaElementType == double.class) { return new DoubleOpenCustomHashSet((Collection<Double>) set, 0.25f, new DoubleStrategy(registry, 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(registry, type)); } else { throw new UnsupportedOperationException("Unsupported native type in set: " + type.getJavaType() + " with type " + type.getTypeSignature()); } }
@SuppressWarnings({"unchecked"}) public static Set<?> toFastutilHashSet(Set<?> set, Type type, FunctionRegistry registry) { // 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(registry, type)); } if (javaElementType == double.class) { return new DoubleOpenCustomHashSet((Collection<Double>) set, 0.25f, new DoubleStrategy(registry, 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(registry, type)); } else { throw new UnsupportedOperationException("Unsupported native type in set: " + type.getJavaType() + " with type " + type.getTypeSignature()); } }
@SuppressWarnings("unchecked") public static Set<?> toFastutilHashSet(Set<?> set, Type type, FunctionRegistry registry) { // 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(registry, type)); } if (javaElementType == double.class) { return new DoubleOpenCustomHashSet((Collection<Double>) set, 0.25f, new DoubleStrategy(registry, 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(registry, type)); } else { throw new UnsupportedOperationException("Unsupported native type in set: " + type.getJavaType() + " with type " + type.getTypeSignature()); } }