Acquire first entry of type constants in BuilderTemplate 94/84194/2
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 4 Sep 2019 12:30:47 +0000 (14:30 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 4 Sep 2019 13:37:10 +0000 (15:37 +0200)
commita27fbe05be80601723f60371ff4130bca16ca568
tree3248f1d254699afd8ef5944061e5bff80802c26a
parentff8b2d05432e6e35f005b9ab7974985b5b4e01d7
Acquire first entry of type constants in BuilderTemplate

Current code is relying on xtend Conversions to get first entry
from keySet/values separately. That code ends up copying the entire
collection into an array before picking the first element, which
is ... far from optimal.

Peel the first entrySet item using iterator().next() and then
reference key/value from there, which removes a dependency on
Conversions and is way more efficient.

Change-Id: I9cf16c416e65e538697aab26ebb5b9a81965e871
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-java-api-generator/src/main/java/org/opendaylight/mdsal/binding/java/api/generator/BuilderTemplate.xtend