示例#1
0
  /** {@inheritDoc} */
  @Override
  public KTypeHashSet<KType> clone() {
    // clone to size() to prevent eventual exponential growth
    final KTypeHashSet<KType> cloned = new KTypeHashSet<KType>(this.size(), this.loadFactor);

    // We must NOT clone, because of the independent perturbation seeds
    cloned.addAll(this);

    return cloned;
  }
示例#2
0
 /** Create a set from a variable number of arguments or an array of <code>KType</code>. */
 public static <KType> KTypeHashSet<KType> from(final KType... elements) {
   final KTypeHashSet<KType> set = new KTypeHashSet<KType>(elements.length);
   set.add(elements);
   return set;
 }