A lot of stuff is happening in that code, so I’m just going to focus on the sorting aspect. It’s correct to use a .sort( (a, b) => ... ) concept, but the code as it stands focuses on the a.length vs b.length, and sort according to these. So what are those?
They are related to arbitrary values in your list, which is a list of Object.entries(). That function in turns returns a key and an originating link list. Since array indexing starts on 0, the a therefore refers to the link list, and the sorting is related to how many times the unresolved list has that particular value. This is an indication on what is the most wanted file in your vault, as the top entries are those most often linking to an unresolved file.
.sort( (a, b) => a.localeCompare( b ) )
And that should sort the entire list on the name of the unresolved link.
Ok, so I have never used Java, I copied the whole thing from another poster. So where would I insert the line of code you just showed me? Or better yet, could you please copy the whole thing with the new code in the right place?
Thanks for all you help! This is quite the steep learning curve but its worth it.