Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
Description
There are several occurences of unnecessary copies of collections in Arrow Java code.
One typical example is for a constructor to copy a collection provided as an argument, and then invoking Collections2 method to create a immutable copy of it, like for Schema (https://github.com/apache/arrow/blob/247a7a9bf1b7090b1bffc14bec84d188dccb52dc/java/vector/src/main/java/org/apache/arrow/vector/types/pojo/Schema.java#L113)
/** * Constructor with metadata. */ public Schema(Iterable<Field> fields, Map<String, String> metadata) { List<Field> fieldList = new ArrayList<>(); for (Field field : fields) { fieldList.add(field); } this.fields = Collections2.immutableListCopy(fieldList); this.metadata = metadata == null ? Collections.emptyMap() : Collections2.immutableMapCopy(metadata); }
Attachments
Issue Links
- links to