question: public void addSuggestions ( final @ NonNull SuggestionsResult result , final @ NonNull String bucket , final @ NonNull TokenSource source ) { QueryToken query = result . getQueryToken ( ) ; synchronized ( mLock ) { mResultMap . put ( bucket , result ) ; Set < String > waitingForBuckets = mWaitingForResults . get ( query ) ; if ( waitingForBuckets != null ) { waitingForBuckets . remove ( bucket ) ; if ( waitingForBuckets . size ( ) == 0 ) { mWaitingForResults . remove ( query ) ; } } } String currentTokenString = source . getCurrentTokenString ( ) ; synchronized ( mLock ) { mSuggestions . clear ( ) ; List < Suggestible > suggestions = mSuggestionsListBuilder . buildSuggestions ( mResultMap , currentTokenString ) ; if ( suggestions . size ( ) > 0 ) { mSuggestions . addAll ( suggestions ) ; mSuggestionsVisibilityManager . displaySuggestions ( true ) ; } else { hideSuggestionsIfNecessary ( result . getQueryToken ( ) , source ) ; } } notifyDataSetChanged ( ) ; }
target:  Add mention suggestions to a given bucket in the adapter. The adapter tracks the latest result for every given bucket, and passes this information to the SuggestionsManager to construct the list of suggestions in the appropriate order. <p> Note: This should be called exactly once for every bucket returned from the query client.