private <T extends Snippet> Stream<T> argsToSnippets(Supplier<Stream<T>> snippetSupplier,
            List<String> args) {
        Stream<T> result = null;
        for (String arg : args) {
            // Find the best match
            Stream<T> st = layeredSnippetSearch(snippetSupplier, arg);
            if (st == null) {
                Stream<Snippet> est = layeredSnippetSearch(state::snippets, arg);
                if (est == null) {
                    errormsg("jshell.err.no.such.snippets", arg);
                } else {
                    errormsg("jshell.err.the.snippet.cannot.be.used.with.this.command",
                            arg, est.findFirst().get().source());
                }
                return null;
            }
            if (result == null) {
                result = st;
            } else {
                result = Stream.concat(result, st);
            }
        }
        return result;
    }
private < T extends Snippet > Stream < T > argsToSnippets ( Supplier < Stream < T > > snippetSupplier , List < String > args ) { Stream < T > result = null ; for ( String arg : args ) { Stream < T > st = layeredSnippetSearch ( snippetSupplier , arg ) ; if ( st == null ) { Stream < Snippet > est = layeredSnippetSearch ( state :: snippets , arg ) ; if ( est == null ) { errormsg ( "jshell.err.no.such.snippets" , arg ) ; } else { errormsg ( "jshell.err.the.snippet.cannot.be.used.with.this.command" , arg , est . findFirst ( ) . get ( ) . source ( ) ) ; } return null ; } if ( result == null ) { result = st ; } else { result = Stream . concat ( result , st ) ; } } return result ; }
Convert user arguments to a Stream of snippets referenced by those
arguments.

@param snippetSupplier the base list of possible snippets
@param args the user's argument to the command, maybe be the empty list
@return a Stream of referenced snippets or null if no matches to specific
arg