Core: use Collection for input of UpdateSchema.setIdentifierFields (#2548)
diff --git a/api/src/main/java/org/apache/iceberg/UpdateSchema.java b/api/src/main/java/org/apache/iceberg/UpdateSchema.java
index 32c3092..f10680e 100644
--- a/api/src/main/java/org/apache/iceberg/UpdateSchema.java
+++ b/api/src/main/java/org/apache/iceberg/UpdateSchema.java
@@ -19,7 +19,7 @@
package org.apache.iceberg;
-import java.util.Set;
+import java.util.Collection;
import org.apache.iceberg.exceptions.CommitFailedException;
import org.apache.iceberg.relocated.com.google.common.collect.Sets;
import org.apache.iceberg.types.Type;
@@ -389,16 +389,18 @@
/**
* Set the identifier fields given a set of field names.
+ * <p>
+ * Because identifier fields are unique, duplicated names will be ignored.
* See {@link Schema#identifierFieldIds()} to learn more about Iceberg identifier.
*
* @param names names of the columns to set as identifier fields
* @return this for method chaining
*/
- UpdateSchema setIdentifierFields(Set<String> names);
+ UpdateSchema setIdentifierFields(Collection<String> names);
/**
* Set the identifier fields given some field names.
- * See {@link UpdateSchema#setIdentifierFields(Set)} for more details.
+ * See {@link UpdateSchema#setIdentifierFields(Collection)} for more details.
*
* @param names names of the columns to set as identifier fields
* @return this for method chaining
diff --git a/core/src/main/java/org/apache/iceberg/SchemaUpdate.java b/core/src/main/java/org/apache/iceberg/SchemaUpdate.java
index 1fb21a0..b387a6b 100644
--- a/core/src/main/java/org/apache/iceberg/SchemaUpdate.java
+++ b/core/src/main/java/org/apache/iceberg/SchemaUpdate.java
@@ -332,7 +332,7 @@
}
@Override
- public UpdateSchema setIdentifierFields(Set<String> names) {
+ public UpdateSchema setIdentifierFields(Collection<String> names) {
this.identifierFieldNames = Sets.newHashSet(names);
return this;
}