src/edu/stanford/nlp/sempre/interactive/VegaLitePathMatcher.java
public List<List<String>> match(List<String> keys) {
    // get partial matches: anything with at least one of the keys
    if (keys == null || keys.size() == 0)
      return paths;
    List<List<String>> partialMatches = keys.stream()
            .flatMap(key -> index.getOrDefault(key, new ArrayList<>()).stream()).collect(Collectors.toList());

    // filter for paths which contain ALL the keys
    Set<List<String>> matchSet = partialMatches
            .stream().filter(match -> keys.stream().allMatch(match::contains))
            .collect(Collectors.toSet());

    List<List<String>> matches = new ArrayList<>(matchSet);

    // sort the lists by their concatenated string representation
    Function<List<String>, String> join = l -> l.stream().collect(Collectors.joining());
    matches.sort(Comparator.comparing(join));

    return matches;
  }
/**
   * Given a list of keys, return all paths containing those keys (not necessarily in the order provided).
   */
Given a list of keys, return all paths containing those keys (not necessarily in the order provided).
Given a list of keys return all paths containing those keys ( not necessarily in the order provided ) .
public List<List<String>> match(List<String> keys) {
    if (keys == null || keys.size() == 0)
      return paths;
    List<List<String>> partialMatches = keys.stream()
            .flatMap(key -> index.getOrDefault(key, new ArrayList<>()).stream()).collect(Collectors.toList());
    Set<List<String>> matchSet = partialMatches
            .stream().filter(match -> keys.stream().allMatch(match::contains))
            .collect(Collectors.toSet());
    List<List<String>> matches = new ArrayList<>(matchSet);
    Function<List<String>, String> join = l -> l.stream().collect(Collectors.joining());
    matches.sort(Comparator.comparing(join));
    return matches;
  }
public List < List < String > > match ( List < String > keys ) { if ( keys == null || keys . size ( ) == 0 ) return paths ; List < List < String > > partialMatches = keys . stream ( ) . flatMap ( key -> index . getOrDefault ( key , new ArrayList < > ( ) ) . stream ( ) ) . collect ( Collectors . toList ( ) ) ; Set < List < String > > matchSet = partialMatches . stream ( ) . filter ( match -> keys . stream ( ) . allMatch ( match :: contains ) ) . collect ( Collectors . toSet ( ) ) ; List < List < String > > matches = new ArrayList < > ( matchSet ) ; Function < List < String > , String > join = l -> l . stream ( ) . collect ( Collectors . joining ( ) ) ; matches . sort ( Comparator . comparing ( join ) ) ; return matches ; }
Given a list of keys, return all paths containing those keys (not necessarily in the order provided).
Given a list of keys return all paths containing those keys ( not necessarily in the order provided ) .
// get partial matches: anything with at least one of the keys // filter for paths which contain ALL the keys // sort the lists by their concatenated string representation