Lists in Java Spring Web and with the Streams API, are they guaranteed to be array-backed?
I am quite confused when working with Java Spring Web as well as the Streams API regarding what kind of Lists are being provided. Especially in the cases when I call Streams.toList() and if I specify a request body to contain a List. Will these lists be backed by arrays in order to provide constant time access? I previously just assumed (not sure why) that they returned Linked Lists, but I have gotten to a point where I need to use .get() on my lists which worries me about performance.
3 Replies
⌛ This post has been reserved for your question.
Hey @TRIGGERED! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./closeor theClose Postbutton above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.The truth is the concrete implementation. Check the sourcecode of
Streams.toList() please. Since the class Streams does not have a toList() method (maybe you meant Stream without the tailing s?). You could check this: https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/util/stream/Stream.java#L1249💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.