EMPIREDB-385 simplification
diff --git a/empire-db/src/main/java/org/apache/empire/db/DBRecord.java b/empire-db/src/main/java/org/apache/empire/db/DBRecord.java
index 9b32cc0..d9ae732 100644
--- a/empire-db/src/main/java/org/apache/empire/db/DBRecord.java
+++ b/empire-db/src/main/java/org/apache/empire/db/DBRecord.java
@@ -293,16 +293,12 @@
             throw new InvalidArgumentException("id", id);
         // convert to array
         Object[] key;
-        if (id instanceof Object[])
-        {   // Cast to array
+        if (id instanceof Object[]) {
+            // Cast to array
             key = (Object[])id;
         } else if (id instanceof Collection<?>) {
             // Convert collection to array
-            Collection<?> col = (Collection<?>)id;
-            key = new Object[col.size()];
-            int i=0;
-            for (Object v : col)
-                key[i++] = v;
+            key = ((Collection<?>)id).toArray();
         } else {
             // Single value
             key = new Object[] { id };
diff --git a/empire-db/src/main/java/org/apache/empire/db/DBRecordBean.java b/empire-db/src/main/java/org/apache/empire/db/DBRecordBean.java
index 8c0ceb5..a593538 100644
--- a/empire-db/src/main/java/org/apache/empire/db/DBRecordBean.java
+++ b/empire-db/src/main/java/org/apache/empire/db/DBRecordBean.java
@@ -220,16 +220,12 @@
             throw new InvalidArgumentException("id", id);
         // convert to array
         Object[] key;
-        if (id instanceof Object[])
-        {   // Cast to array
+        if (id instanceof Object[]) {
+            // Cast to array
             key = (Object[])id;
         } else if (id instanceof Collection<?>) {
             // Convert collection to array
-            Collection<?> col = (Collection<?>)id;
-            key = new Object[col.size()];
-            int i=0;
-            for (Object v : col)
-                key[i++] = v;
+            key = ((Collection<?>)id).toArray();
         } else {
             // Single value
             key = new Object[] { id };