How TreeSet checks for Duplicates

后端 未结 3 487
耶瑟儿~
耶瑟儿~ 2021-02-10 18:02

I am checking how TreeSet checks for duplicate elements and have the following code

  import java.util.*;

  public class TreeDemo{

    public static void main(         


        
3条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-10 18:22

    TreeSet implements a balanced binary search tree based upon ordering of its members (via the Comparable or Comparator interfaces), not on hashing.

    http://en.wikipedia.org/wiki/Self-balancing_binary_search_tree

提交回复
热议问题