#How to maintain the order in which elements added to a collection are saved depending on it?

3 messages · Page 1 of 1 (latest)

frank owl
#

Hello everyone, colleaguesđź‘‹

Can anyone tell me, please, what I'm missing. I need to preserve the order of elements (https://gist.github.com/invzbl3/ebd048d3eb1a06212537d5a543030213#file-bgfeedreader-java-L20) collected in a collection.

I added LinkedHashMap to maintain the order of elements depending on their positions in the list, but when I look at the debug, for some reason it pulls out the title and price, which does not relate to the desired ul-block "Newest for you".

I need it from the first row under “Newest for you”, but it pulls me out from the block that is above “Top New Ranking”. That is, to go first in the debug for 20.44 euros and, accordingly, the name “DarwinFPV ELRS 2.4GHz Cement Ultra Durable Dustproof Waterproof RX Receiver for FPV RC Racing Drone” under the price.

Can anyone, please, explain to me what I am misunderstanding about this approach?

Gist

GitHub Gist: instantly share code, notes, and snippets.

weary whaleBOT
#

⌛ This post has been reserved for your question.

Hey @frank owl! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.