@Override public int size() { return collection.size(); } @Override
@Override public int size() { synchronized (sync) { return collection.size(); } } @Override
/** * Creates a new hash big set copying a given type-specific collection. * * @param c * a type-specific collection to be copied into the new hash big set. * @param f * the load factor. */ public IntOpenHashBigSet(final IntCollection c, final float f) { this(c.size(), f); addAll(c); } /**
/** * Creates a new array set copying the contents of a given collection. * * @param c * a collection. */ public IntArraySet(IntCollection 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 IntLinkedOpenHashSet(final IntCollection 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 IntOpenHashSet(final IntCollection 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 IntOpenCustomHashSet(final IntCollection c, final float f, it.unimi.dsi.fastutil.ints.IntHash.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 IntLinkedOpenCustomHashSet(final IntCollection c, final float f, it.unimi.dsi.fastutil.ints.IntHash.Strategy strategy) { this(c.size(), f, strategy); addAll(c); } /**
@Override public boolean addAll(IntCollection 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(IntCollection 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 IntArrayList(final IntCollection c) { this(c.size()); size = IntIterators.unwrap(c.iterator(), a); } /**
@Override public boolean addAll(IntCollection 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(IntCollection 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
public boolean containsAll(IntCollection c) { final IntIterator i = c.iterator(); int n = c.size(); while (n-- != 0) if (!contains(i.nextInt())) return false; return true; }
public boolean containsAll(IntCollection c) { final IntIterator i = c.iterator(); int n = c.size(); while (n-- != 0) if (!contains(i.nextInt())) return false; return true; }
public boolean containsAll(IntCollection c) { final IntIterator i = c.iterator(); int n = c.size(); while(n-- != 0) if (!contains(i.nextInt())) return false; return true; }
@Override public boolean addAll(int index, final IntCollection 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 IntIterator i = c.iterator(); size += n; while (n-- != 0) a[index++] = i.nextInt(); 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 IntBigArrayBigList(final IntCollection c) { this(c.size()); for (IntIterator i = c.iterator(); i.hasNext();) add(i.nextInt()); } /**
@Override public boolean addAll(IntCollection c) { final long size = c instanceof Size64 ? ((Size64) c).size64() : c.size(); if (f <= .5) ensureCapacity(size); // The resulting collection will be size for c.size() elements else ensureCapacity(size64() + size); // The resulting collection will be sized for size() + c.size() elements return super.addAll(c); } @Override
static public int[] argmax2(float[] scores, IntCollection labels) { if (labels == null || labels.isEmpty()) return argmax2(scores); IntIterator it = labels.iterator(); if (labels.size() < 2) return new int[]{it.nextInt(),-1}; int[] max = {it.nextInt(), it.nextInt()}; if (scores[max[0]] < scores[max[1]]) DSUtils.swap(max, 0, 1); while (it.hasNext()) { int i = it.nextInt(); if (scores[max[0]] < scores[i]) { max[1] = max[0]; max[0] = i; } else if (scores[max[1]] < scores[i]) max[1] = i; } return max; } }