public static < X , Y > List < LocalProperty < Y > > translate ( List < ? extends LocalProperty < X > > properties , Function < X , Optional < Y > > translator ) { properties = normalizeAndPrune ( properties ) ; ImmutableList . Builder < LocalProperty < Y > > builder = ImmutableList . builder ( ) ; for ( LocalProperty < X > property : properties ) { Optional < LocalProperty < Y >> translated = property . translate ( translator ) ; if ( translated . isPresent ( ) ) { builder . add ( translated . get ( ) ) ; } else if ( ! ( property instanceof ConstantProperty ) ) { break ; // Only break if we fail to translate non-constants } } return builder . build ( ) ; }
Translates the properties as much as possible and truncates at the first non - translatable property