Jump to content

Logic behind Account Selector order?


sampla

Recommended Posts

I think its the order you add accounts to it.

 

 

The order you add it, not adding sorting.

Not for me, it's not.

 

I just tried adding an account again to see where it was placed and it was placed 2nd from the top. Made another one and it was placed 5th. I don't get it.

 

Both email addresses started with the same first letter.

Edited by sampla
Link to comment
Share on other sites

Yeah mine aren't added by the order I add them in either. I wondered this as well, but never asked haha.

 

They're stored in a non-linked hashmap.

 

So the JVM can juggle the order around seemingly randomly when new accounts are added to your database, or existing accounts are removed from the hashmap database.

 

If it were a linked hash map, it would be the exact order you add them in.

 

The JVM does low level optimizations and memory management when deciding where to insert them. It's based on your current RAM state, and other factors.

Edited by DragonAlpha
Link to comment
Share on other sites

Tin

A hasmap is used. A hashmap does not guarantee order. You referenced the Java doc's iterator as a reference where it says "Iterator does not guarantee order". Well the same documentation in the Hashmap section says the exact same thing for Hashmap.

 

public class HashMap<K,V>

extends AbstractMap<K,V>

implements Map<K,V>, Cloneable, Serializable

Hash table based implementation of the Map interface. This implementation provides all of the optional map operations, and permits null values and the null key. (The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls.) This class makes no guarantees as to the order of the map

 

 

I can post source code from my decompiler too. Nothing fancy going on.

 

Here is the Iterator:

 

68a7f51d16.png

 

 

Here is the underlying consumer:

 

7e3f800cff.png

Edited by DragonAlpha
  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...