public static List < String > getLabelListByLanguage ( final String languageCode , final LabelOrBuilder label ) throws NotAvailableException { for ( Label . MapFieldEntry entry : label . getEntryList ( ) ) { if ( entry . getKey ( ) . equalsIgnoreCase ( languageCode ) ) { return entry . getValueList ( ) ; } } throw new NotAvailableException ( "LabelList of Language[" + languageCode + "] in labelType[" + label + "]" ) ; }
Get a list of all labels for a languageCode in a label type . This is done by iterating over all entries in the label type and checking if the key matches the languageCode . If it matches the value list is returned . Thus the returned list can be empty depending on the label .