Optimize AbstractTypeGenerator.listKeys() 22/85822/2
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 18 Nov 2019 11:36:45 +0000 (12:36 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 18 Nov 2019 14:13:02 +0000 (15:13 +0100)
In case of an empty key definition we end up allocating
short-lived empty ArrayLists, which is not efficient. Also lists
typically have a few elements, so we end up over-allocating them.

This fixes both cases, by checking the definition first and
returning an empty list in case the definition is empty, as well
as properly allocating efficient implementation where needed.

Change-Id: I99e8843abf6040654fab96052352cbfb29590ecf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>

No differences found