comefrom: <awangdev>1203. Sort Items by Groups Respecting Dependencies_2.java
code: private List<Integer> topoSort(Map<Integer, List<Integer>> graph, Set<Integer> set) {
  
          Map<Integer, Integer> indegree = new HashMap<>();
          for (int item : set) { 
              indegree.put(item, 0);
          }
          for (int node : graph.keySet()) { 
              if (!set.contains(node)) continue; 
              for (int parent : graph.get(node)) { 
                  indegree.put(parent, indegree.get(parent) + 1);
              }
          }
          Queue<Integer> queue = new LinkedList<>();
          for (int key : indegree.keySet()) {
              if (indegree.get(key) == 0) queue.offer(key);
          }
          
          List<Integer> rst = new ArrayList<>();
          while (!queue.isEmpty()) {
              int node = queue.poll();
              rst.add(node);
              if (!graph.containsKey(node)) continue;
              for (int parent : graph.get(node)) {
                  indegree.put(parent, indegree.get(parent) - 1);
                  if (indegree.get(parent) == 0) queue.offer(parent);
              }
          }
          
          return rst;
      }
masked: private List < Integer > var_0 ( Map < Integer , List < Integer >> var_1 , Set < Integer > var_2 ) {
    Map < Integer , Integer > var_3 = new HashMap < > ( ) ;
    for ( int var_4 : var_2 ) {
      var_3 . put ( var_4 , 0 ) ;
    }
    for ( int var_5 : var_1 . keySet ( ) ) {
      if ( ! var_2 . contains ( var_5 ) ) continue ;
      for ( int var_6 : var_1 . get ( var_5 ) ) {
        var_3 . put ( var_6 , var_3 . get ( var_6 ) + 1 ) ;
      }
    }
    Queue < Integer > var_7 = new LinkedList < > ( ) ;
    for ( int var_8 : var_3 . keySet ( ) ) {
      if ( var_3 . get ( var_8 ) == 0 ) var_7 . offer ( var_8 ) ;
    }
    List < Integer > var_9 = new ArrayList < > ( ) ;
    while ( ! var_7 . isEmpty ( ) ) {
      int var_5 = var_7 . poll ( ) ;
      var_9 . add ( var_5 ) ;
      if ( ! var_1 . containsKey ( var_5 ) ) continue ;
      for ( int var_6 : var_1 . get ( var_5 ) ) {
        var_3 . put ( var_6 , var_3 . get ( var_6 ) - 1 ) ;
        if ( var_3 . get ( var_6 ) == 0 ) var_7 . offer ( var_6 ) ;
      }
    }
    return var_9 ;
  }
  