package com.lovecoding.day20.map01;

import org.junit.Test;

import java.util.Comparator;
import java.util.TreeMap;

public class TestMap02_TreeMap {

    @Test
    public void test02() {


        TreeMap<String, String> map = new TreeMap<>(new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                return -o1.compareTo(o2);
            }
        });

        map.put("a","a");
        map.put("c","a");
        map.put("d","a");
        map.put("b","a");
        map.put("e","a");

        System.out.println(map);


    }

    @Test
    public void test01(){
        TreeMap<String,String> map = new TreeMap<>();

        map.put("a","a");
        map.put("c","a");
        map.put("d","a");
        map.put("b","a");
        map.put("e","a");

        System.out.println(map);
    }

}
