Skip to content

inzapp/treemap-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Treemap JSON

JSON with custom comparator using treemap
You can sort json by json key

Download

https://github.com/inzapp/treemap-json/releases

Usage

JSONObject json = new JSONObject(new Comparator<String>() {
    @Override
    public int compare(String a, String b) {
        // parameter a, b is json key
        // just implement your comparator
        return a.compareTo(b);
    }
});

Using lambda expression

json = new JSONObject((Comparator<String>) (a, b) -> {
    return a.compareTo(b);
});