Amazon web services 用于DynamoDB关键变量列表的BatchGetItem

Amazon web services 用于DynamoDB关键变量列表的BatchGetItem,amazon-web-services,amazon-dynamodb,Amazon Web Services,Amazon Dynamodb,我知道我们需要为DDB的BatchGetItem传入属性名和主键名。比如: TableKeysAndAttributes forumTableKeysAndAttributes = new TableKeysAndAttributes(forumTableName); // Add a partition key forumTableKeysAndAttributes.addHashOnlyPrimaryKeys("Animal", "cat", "dog"); BatchGetItemOut

我知道我们需要为DDB的BatchGetItem传入属性名和主键名。比如:

TableKeysAndAttributes forumTableKeysAndAttributes = new TableKeysAndAttributes(forumTableName);
// Add a partition key
forumTableKeysAndAttributes.addHashOnlyPrimaryKeys("Animal", "cat", "dog");

BatchGetItemOutcome outcome = dynamoDB.batchGetItem(forumTableKeysAndAttributes,threadTableKeysAndAttributes);
因此,这里我们手动传入属性名“animal”和两个主键(两种动物狗和猫)。(如果我错了,请纠正我)

但是,如果现在我有一个主键列表,即
[狗、猫、牛、兔、羊、鸡……]
,它以
列表的形式出现,显然我不能手动传递它们,那么我该怎么办


谢谢

假设您有一个哈希键列表:

List<String> keys

您在这里提出的问题基本上是将列表作为参数传递给vararg方法。

假设您有一个哈希键列表:

List<String> keys
您在这里提出的问题基本上是将列表作为参数传递给vararg方法