@Override public int size() { synchronized (sync) { return collection.size(); } } @Override
@Override public int size() { return collection.size(); } @Override
/** * Creates a new array set copying the contents of a given collection. * * @param c * a collection. */ public BooleanArraySet(BooleanCollection 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 BooleanOpenHashSet(final BooleanCollection c, final float f) { this(c.size(), f); addAll(c); } /**
@Override public boolean addAll(BooleanCollection 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 BooleanArrayList(final BooleanCollection c) { this(c.size()); size = BooleanIterators.unwrap(c.iterator(), a); } /**
@Override public boolean addAll(int index, final BooleanCollection 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 BooleanIterator i = c.iterator(); size += n; while (n-- != 0) a[index++] = i.nextBoolean(); 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 BooleanBigArrayBigList(final BooleanCollection c) { this(c.size()); for (BooleanIterator i = c.iterator(); i.hasNext();) add(i.nextBoolean()); } /**