<awangdev>414. Third Maximum Number_1.java
public int thirdMax(int[] nums) {
        PriorityQueue<Integer> pq = new PriorityQueue<>();
        for (int num : nums) {
            if (!pq.contains(num)) {
                pq.offer(num);
                if (pq.size() > 3) pq.poll();
            }
        }
        if (pq.size() < 3) {
            while (pq.size() > 1) pq.poll();
        }
        return pq.peek();
    }
public int sample_funcname ( int [ ] var_0 ) {
  PriorityQueue < Integer > var_3 = new PriorityQueue < > ( ) ;
  for ( int var_4 : var_0 ) {
    if ( ! var_3 . contains ( var_4 ) ) {
      var_3 . offer ( var_4 ) ;
      if ( var_3 . size ( ) > 3 ) var_3 . poll ( ) ;
    }
  }
  if ( var_3 . size ( ) < 3 ) {
    while ( var_3 . size ( ) > 1 ) var_3 . poll ( ) ;
  }
  return var_3 . peek ( ) ;
}
