/** * Creates a new array set copying the contents of a given set. * * @param c * a collection. */ public ByteArraySet(final Collection<? extends Byte> c) { this(c.size()); addAll(c); } /**
@Override public boolean remove(final byte k) { final int pos = findKey(k); if (pos == -1) return false; final int tail = size - pos - 1; for (int i = 0; i < tail; i++) a[pos + i] = a[pos + i + 1]; size--; return true; } @Override
ByteSet socialProofTypeSet = new ByteArraySet(validSocialProofTypes);
ByteSet socialProofTypes = new ByteArraySet(request.getSocialProofTypes());
@Override public boolean contains(final byte k) { return findKey(k) != -1; } @Override
/** * Creates a new array set copying the contents of a given collection. * * @param c * a collection. */ public ByteArraySet(ByteCollection c) { this(c.size()); addAll(c); } /**
@Override public boolean add(final byte k) { final int pos = findKey(k); if (pos != -1) return false; if (size == a.length) { final byte[] b = new byte[size == 0 ? 2 : size * 2]; for (int i = size; i-- != 0;) b[i] = a[i]; a = b; } a[size++] = k; return true; } @Override