public static Collection < String > sanitiseSemanticTypes ( final Collection < String > semanticTypes ) { if ( semanticTypes == null ) return ImmutableList . of ( ) ; // check that each of the given types are in the map we have, otherwise throw it away final Set < String > s = new LinkedHashSet <> ( semanticTypes ) ; return s . retainAll ( SEMANTIC_TYPES_CODE_TO_DESCRIPTION . keySet ( ) ) ? s : semanticTypes ; }
Sanitise semantic types from user input .