private Map < ElementDescriptor < ? > , Object > getDepthStateMap ( int depth , boolean create ) { if ( mState == null ) { mState = new ArrayList < Map < ElementDescriptor < ? > , Object > > ( Math . max ( 16 , depth + 8 ) ) ; } // fill array list with null values up to the current depth while ( depth > mState . size ( ) ) { mState . add ( null ) ; } Map < ElementDescriptor < ? > , Object > map = mState . get ( depth - 1 /* depth is at least 1 */ ) ; if ( ! create || map != null ) { return map ; } // map is null and we shall create it map = new HashMap < ElementDescriptor < ? > , Object > ( 8 ) ; mState . set ( depth - 1 , map ) ; return map ; }
Return the element state map for the given depth creating non - existing maps if required .