Skip to content

chpengzh/avl-treemap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

AVLTreeMap

What is AVL?

you can find the definition of AVLTree in Wiki

Basic Use

AVLTreeMap implements interface Map<K,V>

so you can use it as a single map

and of course, it is thread safe

Insert or Update

map.put(someKey, someValue);

Atomic value combination

map.put(someKey, (old) -> {
    if (old == null) {
        return someValue
    } else {
        return doSomeThing(someValue, old)
    }
})

Page Query with offset and limit (Just like java.util.TreeMap which is implements by Red Black Tree)

//query top n
LinkedHashMap<K,V> result = map.max(offset, limit);
//query last n
LinkedHashMap<K,V> result = map.min(offset, limit)

About

A TreeMap implement by AVL Algorithm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages