RFR: 8273684: Unnecessary Stack usage

Andrey Turbanov github.com+741251+turbanoff at openjdk.java.net
Tue Sep 14 07:32:13 UTC 2021


On Tue, 14 Sep 2021 00:33:32 GMT, Bernd Eckenfels <ecki at zusammenkunft.net> wrote:

>Maybe better use addFirst(), for example in CommandProcessor there is a comment that order matters (did not check it more closely), so it?s probably best to not reverse orders in any place?

In all other places (except HTMLReader), iteration order don't matter. Stack only accessed via _classic_ well known stack operations: push, pop, peek. This methods work in the same way in ArrayDeque. So I think replacing with `addFirst` isn't necessary.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5294


More information about the serviceability-dev mailing list