src/test/java/com/leetcode/hashtable/medium/InsertDeleteGetRandomO1_380.java
public boolean insert(int val) {
      if (map.containsKey(val)) {
        return false;
      }
      map.put(val, list.size());
      list.add(val);

      return true;
    }
/**
     * Inserts a value to the set. Returns true if the set did not already contain the specified
     * element.
     */
Inserts a value to the set. Returns true if the set did not already contain the specified
element.
Inserts a value to the set . Returns true if the set did not already contain the specified element .
public boolean insert(int val) {
      if (map.containsKey(val)) {
        return false;
      }
      map.put(val, list.size());
      list.add(val);
      return true;
    }
public boolean insert ( int val ) { if ( map . containsKey ( val ) ) { return false ; } map . put ( val , list . size ( ) ) ; list . add ( val ) ; return true ; }
Inserts a value to the set.
Inserts a value to the set .