public void findFriend(String s, List<List<Integer>> pairs) {         int n = s.length();         int[] father = new int[n];         /*记录秩*/         int[] rank = new int[n];         for(int i = 0; i < n; i++) {             father[i] = i;             rank[i] = 1;         }                  for(List<Integer> pair : pairs) {             union(pair.get(0),pair.get(1),father,rank);         }         char[] sChar = s.toCharArray();         /*key : 根节点   Value: 这个根节点的连通分量*/         Map<Integer,Queue<Character>> map = new HashMap();         for(int i = 0; i < n; i++) {             int root = find(i,father);             if(map.containsKey(root)) {                 map.get(root).offer(sChar[i]);             } else{                 Queue<Character> queue = new LinkedList<>();                 queue.offer(sChar[i]);                 map.put(root,queue);             }         }     }