diff --git a/src/main/java/io/github/spannm/jackcess/IndexBuilder.java b/src/main/java/io/github/spannm/jackcess/IndexBuilder.java index 39e4003..3a8c7a2 100644 --- a/src/main/java/io/github/spannm/jackcess/IndexBuilder.java +++ b/src/main/java/io/github/spannm/jackcess/IndexBuilder.java @@ -19,10 +19,7 @@ import io.github.spannm.jackcess.impl.*; import java.io.IOException; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; +import java.util.*; /** * Builder style class for constructing an {@link Index}. See {@link TableBuilder} for example usage. Additionally, an @@ -99,6 +96,14 @@ public IndexBuilder withColumns(String... names) { * Adds the columns with the given ordering to the index. */ public IndexBuilder withColumns(boolean ascending, String... names) { + return names != null ? withColumns(ascending, Arrays.asList(names)) : this; + } + + public IndexBuilder withColumns(Iterable names) { + return withColumns(true, names); + } + + public IndexBuilder withColumns(boolean ascending, Iterable names) { if (names != null) { for (String name : names) { _columns.add(new Column(name, ascending)); @@ -130,7 +135,7 @@ public IndexBuilder withUnique() { } /** - * Sets this index to encforce required. + * Sets this index to enforce required. */ public IndexBuilder withRequired() { _flags |= IndexData.REQUIRED_INDEX_FLAG;