How TreeSet checks for Duplicates

后端 未结 3 780
感情败类
感情败类 2021-02-10 18:06

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:18

    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

提交回复
热议问题