Zoltan Farkas created AVRO-1607: ----------------------------------- Summary: Minor performance enhancement Key: AVRO-1607 URL: https://issues.apache.org/jira/browse/AVRO-1607 Project: Avro Issue Type: Improvement Components: java Affects Versions: 1.8.0 Reporter: Zoltan Farkas Priority: Minor
In SpecificData.getClass, line 164: case UNION: List<Schema> types = schema.getTypes(); // elide unions with null if ((types.size() == 2) && types.contains(NULL_SCHEMA)) return getWrapper(types.get(types.get(0).equals(NULL_SCHEMA) ? 1 : 0)); return Object.class; can be written more efficiently as: case UNION: List<Schema> types = schema.getTypes(); // elide unions with null if ((types.size() == 2)) { if (NULL_SCHEMA.equals(types.get(0))) { return getWrapper(types.get(1)); } else if (NULL_SCHEMA.equals(types.get(1))) { return getWrapper(types.get(0)); } } return Object.class; -- This message was sent by Atlassian JIRA (v6.3.4#6332)