@ Override public List < ApiType > index ( String indexName , Object obj ) { lock . lock ( ) ; try { if ( ! this . indexers . containsKey ( indexName ) ) { throw new IllegalArgumentException ( String . format ( "index %s doesn't exist!" , indexName ) ) ; } Function < ApiType , List < String > > indexFunc = this . indexers . get ( indexName ) ; List < String > indexKeys = indexFunc . apply ( ( ApiType ) obj ) ; Map < String , Set < String > > index = this . indices . get ( indexName ) ; if ( io . kubernetes . client . util . common . Collections . isEmptyMap ( index ) ) { return new ArrayList <> ( ) ; } Set < String > returnKeySet = new HashSet <> ( ) ; for ( String indexKey : indexKeys ) { Set < String > set = index . get ( indexKey ) ; if ( io . kubernetes . client . util . common . Collections . isEmptyCollection ( set ) ) { continue ; } returnKeySet . addAll ( set ) ; } List < ApiType > items = new ArrayList <> ( returnKeySet . size ( ) ) ; for ( String absoluteKey : returnKeySet ) { items . add ( this . items . get ( absoluteKey ) ) ; } return items ; } finally { lock . unlock ( ) ; } }
Get objects .