private static Integer getFreeId ( ) { if ( ! RECYCLE . isEmpty ( ) ) { final Integer id = RECYCLE . poll ( ) ; IDS . add ( id ) ; return id ; } if ( IDS . size ( ) == Integer . MAX_VALUE ) { throw new LionEngineException ( ERROR_FREE_ID ) ; } Integer id ; while ( IDS . contains ( id = Integer . valueOf ( lastId ) ) ) // CHECKSTYLE IGNORE LINE: TrailingComment|InnerAssignment { lastId ++ ; } IDS . add ( id ) ; return id ; }
Get the next unused ID .