@Override public Selection selectIsIn(Collection<String> strings) { ShortOpenHashSet keys = new ShortOpenHashSet(strings.size()); for (String string : strings) { short key = getKeyForValue(string); if (key != DEFAULT_RETURN_VALUE) { keys.add(key); } } Selection results = new BitmapBackedSelection(); for (int i = 0; i < values.size(); i++) { if (keys.contains(values.getShort(i))) { results.add(i); } } return results; }
@Override public Selection selectIsIn(String... strings) { ShortOpenHashSet keys = new ShortOpenHashSet(strings.length); for (String string : strings) { short key = getKeyForValue(string); if (key != DEFAULT_RETURN_VALUE) { keys.add(key); } } Selection results = new BitmapBackedSelection(); for (int i = 0; i < values.size(); i++) { if (keys.contains(values.getShort(i))) { results.add(i); } } return results; }
/** * Creates a new hash set and fills it with the elements of a given array. * * @param a * an array whose elements will be used to fill the set. * @param offset * the first element to use. * @param length * the number of elements to use. * @param f * the load factor. */ public ShortOpenHashSet(final short[] a, final int offset, final int length, final float f) { this(length < 0 ? 0 : length, f); ShortArrays.ensureOffsetLength(a, offset, length); for (int i = 0; i < length; i++) add(a[offset + i]); } /**
/** * Creates a new hash set using elements provided by a type-specific iterator. * * @param i * a type-specific iterator whose elements will fill the set. * @param f * the load factor. */ public ShortOpenHashSet(final ShortIterator i, final float f) { this(DEFAULT_INITIAL_SIZE, f); while (i.hasNext()) add(i.nextShort()); } /**
@Override public Selection selectIsIn(Collection<String> strings) { ShortOpenHashSet keys = new ShortOpenHashSet(strings.size()); for (String string : strings) { short key = getKeyForValue(string); if (key != DEFAULT_RETURN_VALUE) { keys.add(key); } } Selection results = new BitmapBackedSelection(); for (int i = 0; i < values.size(); i++) { if (keys.contains(values.getShort(i))) { results.add(i); } } return results; }
@Override public Selection selectIsIn(String... strings) { ShortOpenHashSet keys = new ShortOpenHashSet(strings.length); for (String string : strings) { short key = getKeyForValue(string); if (key != DEFAULT_RETURN_VALUE) { keys.add(key); } } Selection results = new BitmapBackedSelection(); for (int i = 0; i < values.size(); i++) { if (keys.contains(values.getShort(i))) { results.add(i); } } return results; }