Return the primary key index for a given collection.

        :param collection: the collection for which to return the primary index

        :returns: the primary key index of the given collection
351906
def get_pk_index(self, collection):
        
        cls = self.collections[collection]

        if not cls.get_pk_name() in self.indexes[collection]:
            self.create_index(cls.get_pk_name(), collection)
        return self.indexes[collection][cls.get_pk_name()]
545222
public static <T> List<T> getUnique(Collection<T> collection) {
        HashSet<T> set = new HashSet<>();
        List<T> out = new ArrayList<>();
        for (T t : collection) {
            if (!set.contains(t)) {
                out.add(t);
                set.add(t);
            }
        }
        return out;
    }
822155
def items_by_id(cls, ids, collection):
        
        col = cls.collection(collection)
        items = []
        base_url = urljoin(config.API_URL, 'collections/%s/items' % collection)
        for id in ids:
            try:
                items.append(Item(cls.query(urljoin(base_url, id))))
            except SatSearchError as err:
                pass
        return Items(items, collections=[col])
563579
def get_collection(self):
        
        db_mongo = self._mongo_client[self._index]
        return db_mongo[self._collection]
859837
def get_collection(self, path, query, **options):
        
        options = self._merge_options(options)
        if options['iterator_type'] == 'items':
            return CollectionPageIterator(self, path, query, options).items()
        if options['iterator_type'] is None:
            return self.get(path, query, **options)
        raise Exception('Unknown value for "iterator_type" option: {}'.format(
            str(options['iterator_type'])))
616362
def collection_keys(coll, sep='.'):
    
    def _keys(x, pre=''):
        for k in x:
            yield (pre + k)
            if isinstance(x[k], dict):
                for nested in _keys(x[k], pre + k + sep):
                    yield nested

    return list(_keys(coll.find_one()))
1138182
def primary_key_field(self):
        
        return [field for field in self.instance._meta.fields if field.primary_key][0]
812837
def get_record_collections(record, matcher):
    
    collections = current_collections.collections
    if collections is None:
        # build collections cache
        collections = current_collections.collections = dict(_build_cache())

    output = set()

    for collections in matcher(collections, record):
        output |= collections

    return list(output)
70979
def index(self) -> dict:
        

        LOGGER.debug('SchemaCache.index >>>')

        rv = self._seq_no2schema_key
        LOGGER.debug('SchemaCache.index <<< %s', rv)
        return rv
482554
public static <T> T get(Collection<T> collection, int index) {
		if (null == collection) {
			return null;
		}

		final int size = collection.size();
		if (index < 0) {
			index += size;
		}

		// 检查越界
		if (index >= size) {
			return null;
		}

		if (collection instanceof List) {
			final List<T> list = ((List<T>) collection);
			return list.get(index);
		} else {
			int i = 0;
			for (T t : collection) {
				if (i > index) {
					break;
				} else if (i == index) {
					return t;
				}
				i++;
			}
		}
		return null;
	}
326044
def _get_collection(collection_id):
    
    try:
        collection = db.DBSession.query(DatasetCollection).filter(DatasetCollection.id==collection_id).one()
        return collection
    except NoResultFound:
        raise ResourceNotFoundError("No dataset collection found with id %s"%collection_id)
1341448
def get_collections(self):
        
        collections = self.request.matchdict['collections'].split('/')[0]
        collections = [coll.strip() for coll in collections.split(',')]
        return set(collections)
550616
public function getDictionary($collection)
	{
		$dictionary = array();

		foreach ($collection as $value)
		{
			$dictionary[$value->getKey()] = $value;
		}

		return $dictionary;
	}
479816
def _get_collection(self, collection_name):
        
        try:
            return self._database[collection_name]
        except InvalidName as ex:
            raise DataSourceError("Cannot access MongoDB collection %s!"
                                  % collection_name) from ex
        except Exception as ex:
            raise DataSourceError("Unexpected error when accessing MongoDB"
                                  "collection %s!"
                                  % collection_name) from ex
674762
function get_associated_collections(collection) {
  const map = new Map()

  get_association_keys(collection)
    // Return the identity to the related resource.
    .forEach(key => {
      // Get the attributes
      const collection_attributes = collection._attributes[key]

      // Most of the time, it's a one to one
      // relationship so it's not an array.
      let is_array = false

      // But sometimes, it's a one to many
      // so array must be true.
      if (collection_attributes.hasOwnProperty("collection")) {
        is_array = true
      }

      // Set the values.
      map.set(key, { is_array, collection })
    })

  return map
}
371642
def get_index(self, key):
        
        try:
            return self[self.index_lookup.get(key)]

        except TypeError:
            raise KeyError
1317320
public static int[] toIntArray(Collection<Integer> collection) {
        int[] collectionArray = new int[collection.size()];
        int index = 0;
        for (Integer item : collection) {
            collectionArray[index++] = item;
        }
        return collectionArray;
    }