Build the Criteria using IN(...) for single keys
@param ids collection of identities
@param field
@return Criteria
173638
private Criteria buildPrefetchCriteriaSingleKey(Collection ids, FieldDescriptor field)
    {
        Criteria crit = new Criteria();
        ArrayList values = new ArrayList(ids.size());
        Iterator iter = ids.iterator();
        Identity id;

        while (iter.hasNext())
        {
            id = (Identity) iter.next();
            values.add(id.getPrimaryKeyValues()[0]);
        }

        switch (values.size())
        {
            case 0:
                break;
            case 1:
                crit.addEqualTo(field.getAttributeName(), values.get(0));
                break;
            default:
                // create IN (...) for the single key field
                crit.addIn(field.getAttributeName(), values);
                break;
        }

        return crit;
    }
826386
private static byte[] getIids2(final List<BeanId> ids, final UniqueIds uids) {
        if (ids == null) {
            return new byte[0];
        }
        final AbstractList<String> list = new AbstractList<String>() {

            @Override
            public String get(int index) {
                return ids.get(index).getInstanceId();
            }

            @Override
            public int size() {
                return ids.size();
            }
        };
        return getIids(list, uids);
    }
798773
function ( req ) {

    var pk = req.options.id || (req.options.where && req.options.where.id) || req.param('id');

    // TODO: make this smarter...
    // (e.g. look for actual primary key of model and look for it
    //  in the absence of `id`.)
    // See coercePK for reference (although be aware it is not currently in use)

    // exclude criteria on id field
    pk = _.isPlainObject(pk) ? undefined : pk;
    return pk;
  }
1145913
@SuppressWarnings("rawtypes")
    public org.grails.datastore.mapping.query.api.Criteria inList(String propertyName, Collection values) {
        return in(propertyName, values);
    }
108275
private Set<String> getLeastUbique(Collection<String> ids)
	{
		Set<String> select = new HashSet<String>();

		int s = getLeastScore(ids);

		for (String id : ids)
		{
			if (score.get(id) == s) select.add(id);
		}

		return select;
	}
608436
public function where_in($field = '', $in = array())
	{
		$this->_where_init($field);
		$this->wheres[$field]['$in'] = $in;
		return $this;
	}
1061893
public static Integer[] transformToInt(final String[] ids) {
    if (ids == null) return new Integer[0];
    Integer[] idsOfInteger = new Integer[ids.length];
    for (int i = 0; i < ids.length; i++) {
      idsOfInteger[i] = new Integer(ids[i]);
    }
    return idsOfInteger;
  }
845891
private static String generateUniqueId(Set<String> ids, String idBase) {
		String id = idBase;
		int counter = 1;
		while (ids.contains(id)) {
			id = idBase + String.valueOf(counter++);
		}
		
		// put the newly generated one into the set
		ids.add(id);
		return id;
	}
80138
public Criteria in(Iterable<?> values) {
		Assert.notNull(values, "Collection of 'in' values must not be null");
		for (Object value : values) {
			if (value instanceof Collection) {
				in((Collection<?>) value);
			} else {
				is(value);
			}
		}
		return this;
	}
614212
public Index mapper(String field, Mapper mapper) {
        schema.mapper(field, mapper);
        return this;
    }
260520
public static <X> String createFieldId(Field field, Collection<Annotation> annotations) {
        StringBuilder builder = new StringBuilder();
        builder.append(field.getDeclaringClass().getName());
        builder.append('.');
        builder.append(field.getName());
        builder.append(createAnnotationCollectionId(annotations));
        return builder.toString();
    }
350186
public static Query in(String field, Collection<?> values) {
        return new Query().in(field, values);
    }
747408
public static Query notIn(String field, Collection<?> values) {
        return new Query().notIn(field, values);
    }
907467
@Override
    public BigIntegerMapper build(String field) {
        return new BigIntegerMapper(field, column, validated, digits);
    }
690829
public DataCenterFilter id(String... ids) {
        allItemsNotNull(ids, "Data center ID list");

        this.predicate = this.predicate.and(combine(
            DataCenterMetadata::getId, in(asList(ids), Predicates::equalsIgnoreCase)
        ));

        return this;
    }
836169
public Difference<BaseType> compareArraysWithId(List<String> field1,
                                                    ArrayType node1,
                                                    List<String> field2,
                                                    ArrayType node2,
                                                    IdentityExtractor idex)
            throws InvalidArrayIdentity, DuplicateArrayIdentity {
        Difference<BaseType> ret = new Difference<>();
        // Build a map of identity -> index for both arrays
        final Map<Object, Integer> identities1 = getIdentityMap(field1, node1, idex);
        final Map<Object, Integer> identities2 = getIdentityMap(field2, node2, idex);

        // Iterate all elements of array 1
        for (Map.Entry<Object, Integer> entry1 : identities1.entrySet()) {
            // Append index to the field name
            field1.add(Integer.toString(entry1.getValue()));

            // If array2 doesn't have an element with the same ID, this is a deletion
            Integer index2 = identities2.get(entry1.getKey());
            if (index2 == null) {
                ret.add(new Removal(field1, getElement(node1, entry1.getValue())));
            } else {
                field2.add(Integer.toString(index2));
                // array2 has the same element
                // If it is at a different index, this is a move
                if (index2 != entry1.getValue()) {
                    ret.add(new Move(field1, field2, getElement(node1, entry1.getValue())));
                }
                // Recursively compare contents to get detailed diff
                ret.add(compareNodes(field1, getElement(node1, entry1.getValue()),
                        field2, getElement(node2, index2)));
                pop(field2);
            }
            pop(field1);
        }
        // Now check elements of array 2 that are not in array 1
        for (Map.Entry<Object, Integer> entry2 : identities2.entrySet()) {
            if (!identities1.containsKey(entry2.getKey())) {
                // entry2 is not in array 1: addition
                field2.add(Integer.toString(entry2.getValue()));
                ret.add(new Addition(field2, getElement(node2, entry2.getValue())));
                pop(field2);
            }
        }
        return ret;
    }
835877
public static Builder pullAll(String field, Object... values) {
        return new Builder().pullAll(field, values);
    }