This is an automated email from the ASF dual-hosted git repository.

fokko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iceberg.git


The following commit(s) were added to refs/heads/master by this push:
     new b96da4626f API: Optimize the Array creation (#5733)
b96da4626f is described below

commit b96da4626f2897275c41696e55432faff9b9d71a
Author: feiyang_deepnova <[email protected]>
AuthorDate: Wed Oct 12 15:21:32 2022 +0800

    API: Optimize the Array creation (#5733)
    
    * code optimization
    
    * better optimization
---
 api/src/main/java/org/apache/iceberg/PartitionSpec.java | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/api/src/main/java/org/apache/iceberg/PartitionSpec.java 
b/api/src/main/java/org/apache/iceberg/PartitionSpec.java
index 6270e3b5cb..8474ca154a 100644
--- a/api/src/main/java/org/apache/iceberg/PartitionSpec.java
+++ b/api/src/main/java/org/apache/iceberg/PartitionSpec.java
@@ -67,10 +67,7 @@ public class PartitionSpec implements Serializable {
       Schema schema, int specId, List<PartitionField> fields, int 
lastAssignedFieldId) {
     this.schema = schema;
     this.specId = specId;
-    this.fields = new PartitionField[fields.size()];
-    for (int i = 0; i < this.fields.length; i += 1) {
-      this.fields[i] = fields.get(i);
-    }
+    this.fields = fields.toArray(new PartitionField[0]);
     this.lastAssignedFieldId = lastAssignedFieldId;
   }
 

Reply via email to