@Override public int size() { return collection.size(); } @Override
@Override public int size() { synchronized (sync) { return collection.size(); } } @Override
/** * Creates a new array set copying the contents of a given collection. * * @param c * a collection. */ public ShortArraySet(ShortCollection c) { this(c.size()); addAll(c); } /**
/** * Creates a new hash set copying a given type-specific collection. * * @param c * a type-specific collection to be copied into the new hash set. * @param f * the load factor. */ public ShortLinkedOpenHashSet(final ShortCollection c, final float f) { this(c.size(), f); addAll(c); } /**
/** * Creates a new hash set copying a given type-specific collection. * * @param c * a type-specific collection to be copied into the new hash set. * @param f * the load factor. */ public ShortOpenHashSet(final ShortCollection c, final float f) { this(c.size(), f); addAll(c); } /**
/** * Creates a new hash set copying a given type-specific collection. * * @param c * a type-specific collection to be copied into the new hash set. * @param f * the load factor. * @param strategy * the strategy. */ public ShortLinkedOpenCustomHashSet(final ShortCollection c, final float f, it.unimi.dsi.fastutil.shorts.ShortHash.Strategy strategy) { this(c.size(), f, strategy); addAll(c); } /**
/** * Creates a new hash set copying a given type-specific collection. * * @param c * a type-specific collection to be copied into the new hash set. * @param f * the load factor. * @param strategy * the strategy. */ public ShortOpenCustomHashSet(final ShortCollection c, final float f, it.unimi.dsi.fastutil.shorts.ShortHash.Strategy strategy) { this(c.size(), f, strategy); addAll(c); } /**
@Override public boolean addAll(ShortCollection c) { if (f <= .5) ensureCapacity(c.size()); // The resulting collection will be sized for c.size() elements else tryCapacity(size() + c.size()); // The resulting collection will be tentatively sized for size() + c.size() // elements return super.addAll(c); } @Override
@Override public boolean addAll(ShortCollection c) { if (f <= .5) ensureCapacity(c.size()); // The resulting collection will be sized for c.size() elements else tryCapacity(size() + c.size()); // The resulting collection will be tentatively sized for size() + c.size() // elements return super.addAll(c); } @Override
/** * Creates a new array list and fills it with a given type-specific collection. * * @param c * a type-specific collection that will be used to fill the array * list. */ public ShortArrayList(final ShortCollection c) { this(c.size()); size = ShortIterators.unwrap(c.iterator(), a); } /**
@Override public boolean addAll(ShortCollection c) { if (f <= .5) ensureCapacity(c.size()); // The resulting collection will be sized for c.size() elements else tryCapacity(size() + c.size()); // The resulting collection will be tentatively sized for size() + c.size() // elements return super.addAll(c); } @Override
@Override public boolean addAll(ShortCollection c) { if (f <= .5) ensureCapacity(c.size()); // The resulting collection will be sized for c.size() elements else tryCapacity(size() + c.size()); // The resulting collection will be tentatively sized for size() + c.size() // elements return super.addAll(c); } @Override
@Override public boolean addAll(int index, final ShortCollection c) { ensureIndex(index); int n = c.size(); if (n == 0) return false; grow(size + n); if (index != size) System.arraycopy(a, index, a, index + n, size - index); final ShortIterator i = c.iterator(); size += n; while (n-- != 0) a[index++] = i.nextShort(); assert size <= a.length; return true; } @Override
/** * Creates a new big-array big list and fills it with a given type-specific * collection. * * @param c * a type-specific collection that will be used to fill the array * list. */ public ShortBigArrayBigList(final ShortCollection c) { this(c.size()); for (ShortIterator i = c.iterator(); i.hasNext();) add(i.nextShort()); } /**