public boolean add ( final K key , final S subcontainer , final V value ) { final S curSubcontainer = this . subcontainerByKey . get ( key ) ; if ( curSubcontainer == null ) { // key does not exist if ( this . mode == Mode . UPDATE ) return false ; } else { // key exists if ( this . mode == Mode . CREATE ) return false ; if ( subcontainer != curSubcontainer ) { if ( this . closed ) throw new IllegalStateException ( "MultiContainer put(" + key + ", " + value + ") in " + subcontainer ) ; this . valueByKeyBySubcontainer . get ( curSubcontainer ) . remove ( key ) ; } } if ( subcontainer != curSubcontainer ) this . subcontainerByKey . put ( key , subcontainer ) ; final Map < K , V > valueByKey = this . valueByKeyBySubcontainer . get ( subcontainer ) ; if ( this . closed && ! valueByKey . containsKey ( key ) ) throw new IllegalStateException ( "MultiContainer put(" + key + ", " + value + ") in " + subcontainer ) ; else if ( this . debug && ! valueByKey . containsKey ( key ) ) Logger . getLogger ( "debug" ) . severe ( "MultiContainer put(" + key + ", " + value + ") in " + subcontainer ) ; valueByKey . put ( key , value ) ; return true ; }
Add a value to this multi container