How HashMap-sharpkeySet () gets the key collection of map

clipboard.png

the source code uses ks = new KeySet () to create KeySet () objects, but the default constructor of KeySet does nothing, and how does he know the key collection of map . The breakpoint is typed ks = new KeySet () , and you can know the value after executing the statement. I don"t understand.

Mar.22,2021

are you sure you haven't overlooked anything?

public Set<K> keySet() {
    Set<K> ks;
    // keySetnullKeySetkeySet;keySet
    return (ks = keySet) == null ? (keySet = new KeySet()) : ks;
}

if the above break point is ks = new KeySet () , it will only be executed if keySet is null . It is recommended that you start the break point

from Set < K > ks = keySet .
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b32529-2b580.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b32529-2b580.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?