protected void cacheSizes ( ) { mAdapterSizes . clear ( ) ; int size = 0 ; for ( IAdapter < Item > adapter : mAdapters ) { if ( adapter . getAdapterItemCount ( ) > 0 ) { mAdapterSizes . append ( size , adapter ) ; size = size + adapter . getAdapterItemCount ( ) ; } } //we also have to add this for the first adapter otherwise the floorIndex method will return the wrong value if ( size == 0 && mAdapters . size ( ) > 0 ) { mAdapterSizes . append ( 0 , mAdapters . get ( 0 ) ) ; } mGlobalSize = size ; }
we cache the sizes of our adapters so get accesses are faster