synchronized public int getFirstFreeDTMID ( ) { int n = m_dtms . length ; for ( int i = 1 ; i < n ; i ++ ) { if ( null == m_dtms [ i ] ) { return i ; } } return n ; // count on addDTM() to throw exception if out of range }
Get the first free DTM ID available . %OPT% Linear search is inefficient!