rmannibucau commented on a change in pull request #69:
URL: https://github.com/apache/openjpa/pull/69#discussion_r456520863



##########
File path: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/Table.java
##########
@@ -312,11 +315,20 @@ public String getResourceName() {
         return _rels;
     }
 
+    /**
+     * Return the list of column names, used only for informative (error) 
messages.
+     * @return
+     */
     public String[] getColumnNames() {
         if (_colMap == null) {
             return new String[0];
         }
-        DBIdentifier[] sNames = _colMap.keySet().toArray(new 
DBIdentifier[_colMap.size()]);

Review comment:
       Hmm, maybe diff is not up to date but you still allocate 2 arrays, first 
one is a DBIdentifier array instead of an ArrayList but it is ~the same size 
(I'm thinking to the case we have > 200 columns in the db and it happens) so I 
would just do:
   
   _colMap
   .values()
   .stream()
   .map(Column::getIdentifier)
   .map(DBIdentifier::getName)
   .toArray(String[]::new);




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to