public boolean add ( int e ) { if ( e < 0 || e >= has . length ) throw new IllegalArgumentException ( "Input must be in range [0, " + has . length + ") not " + e ) ; else if ( contains ( e ) ) return false ; else { if ( nnz == 0 ) { first = e ; next [ e ] = prev [ e ] = STOP ; } else { prev [ first ] = e ; next [ e ] = first ; prev [ e ] = STOP ; first = e ; } nnz ++ ; return has [ e ] = true ; } }
Adds a new integer into the set