<awangdev>496. Next Greater Element I_1.java
private Map<Integer, Integer> generateSubMap(int[] base) {

        Stack<Integer> stack = new Stack<>();
        Map<Integer, Integer> baseMap = new HashMap<>();
        for (int num : base) {
            while (!stack.isEmpty() && stack.peek() < num) {
                int pop = stack.pop();
                baseMap.put(pop, num);
            }
            stack.push(num);
        }
        return baseMap;
    }
private Map < Integer , Integer > var_1 ( int [ ] var_2 ) {
  Stack < Integer > var_4 = new Stack < > ( ) ;
  Map < Integer , Integer > var_7 = new HashMap < > ( ) ;
  for ( int var_8 : var_2 ) {
    while ( ! var_4 . isEmpty ( ) && var_4 . peek ( ) < var_8 ) {
      int pop = var_4 . pop ( ) ;
      var_7 . put ( pop , var_8 ) ;
    }
    var_4 . push ( var_8 ) ;
  }
  return var_7 ;
}
