From d2ec0e7bdd8faea3ad5553a276299573fb52ff78 Mon Sep 17 00:00:00 2001 From: Roland Praml Date: Sun, 8 Jul 2018 16:54:20 +0200 Subject: replace Collection by FieldAccess[] array (saves iterator instance) --- src/core/lombok/core/AST.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/core/lombok') diff --git a/src/core/lombok/core/AST.java b/src/core/lombok/core/AST.java index 1142018f..fe7a4330 100644 --- a/src/core/lombok/core/AST.java +++ b/src/core/lombok/core/AST.java @@ -216,19 +216,19 @@ public abstract class AST, L extends LombokNode, } } - private static final ConcurrentMap, Collection> fieldsOfASTClasses = new ConcurrentHashMap, Collection>(); + private static final ConcurrentMap, FieldAccess[]> fieldsOfASTClasses = new ConcurrentHashMap, FieldAccess[]>(); /** Returns FieldAccess objects for the stated class. Each field that contains objects of the kind returned by * {@link #getStatementTypes()}, either directly or inside of an array or java.util.collection (or array-of-arrays, * or collection-of-collections, et cetera), is returned. */ - protected Collection fieldsOf(Class c) { - Collection fields = fieldsOfASTClasses.get(c); + protected FieldAccess[] fieldsOf(Class c) { + FieldAccess[] fields = fieldsOfASTClasses.get(c); if (fields != null) return fields; - fields = new ArrayList(); - getFields(c, fields); - fieldsOfASTClasses.putIfAbsent(c, fields); + List fieldList = new ArrayList(); + getFields(c, fieldList); + fieldsOfASTClasses.putIfAbsent(c, fieldList.toArray(new FieldAccess[fieldList.size()])); return fieldsOfASTClasses.get(c); } -- cgit