package yokohama.unit.ast;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class TableExtractVisitor {
    public List<Table> extractTables(Group group) {
        List<Definition> definitions = group.getDefinitions();
        return definitions
                .stream()
                .flatMap(definition ->
                        definition.accept(
                                test -> Stream.empty(),
                                fourPhaseTest -> Stream.empty(),
                                table -> Stream.of(table),
                                codeBlock -> Stream.empty(),
                                heading -> Stream.empty()))
                .collect(Collectors.toList());
    }
}

@@ -47,16 +47,39 @@
 .List;%0D%0A
+import java.util.Map;%0D%0A
 import j
@@ -144,44 +144,333 @@
 m;%0D%0A
-%0D%0Apublic class TableExtractVisitor %7B
+import yokohama.unit.util.Lists;%0D%0Aimport yokohama.unit.util.Pair;%0D%0A%0D%0Apublic class TableExtractVisitor %7B%0D%0A    public Map%3CString, Table%3E extractMap(Group group) %7B%0D%0A        List%3CTable%3E tables = extractTables(group);%0D%0A        return Lists.listToMap(%0D%0A                tables, table -%3E new Pair%3C%3E(table.getName(), table));%0D%0A    %7D%0D%0A
 %0D%0A  

Add extractMap method to TableExtractVisitor