Closed vax-r closed 2 weeks ago
Take advantages of BTreeMap's Entry API working with or_insert() to do the conditional insertion. Insert only when the entry doesn't exist. Doing so can reduce the amount of code and provide better readability and perform in-place manipulation.
Summary
Take advantages of BTreeMap's Entry API working with or_insert() to do the conditional insertion. Insert only when the entry doesn't exist. Doing so can reduce the amount of code and provide better readability and perform in-place manipulation.
Reference