public boolean add ( final OIdentifiable e ) { if ( e . getIdentity ( ) . isNew ( ) ) { final ORecord < ? > record = e . getRecord ( ) ; // ADD IN TEMP LIST if ( newItems == null ) newItems = new IdentityHashMap < ORecord < ? > , Object > ( ) ; else if ( newItems . containsKey ( record ) ) return false ; newItems . put ( record , NEWMAP_VALUE ) ; setDirty ( ) ; return true ; } else if ( OGlobalConfiguration . LAZYSET_WORK_ON_STREAM . getValueAsBoolean ( ) && getStreamedContent ( ) != null ) { // FAST INSERT final String ridString = e . getIdentity ( ) . toString ( ) ; final StringBuilder buffer = getStreamedContent ( ) ; if ( buffer . indexOf ( ridString ) < 0 ) { if ( buffer . length ( ) > 0 ) buffer . append ( ' ' ) ; e . getIdentity ( ) . toString ( buffer ) ; setDirty ( ) ; return true ; } return false ; } else { final int pos = indexOf ( e ) ; if ( pos < 0 ) { // FOUND delegate . add ( pos * - 1 - 1 , e ) ; return true ; } return false ; } }
Adds the item in the underlying List preserving the order of the collection .