Database implements Serializable, Cloneable { public void removeAllTablesExcept(String... tableNames) { Iterator<Table> tableIterator = this.tables.iterator(); while(tableIterator.hasNext()) { Table table = tableIterator.next(); boolean foundTable = false; for (String tableName : tableNames) { if (tableName.equals(table.getName())) { foundTable = true; break; } } if (!foundTable) { tableIterator.remove(); } } }  static List<Table> sortByForeignKeys(List<Table> tables, Map<String, Table> allTables,
            Map<Integer, Set<Table>> dependencyMap, Map<Table, Set<String>> missingDependencyMap); static void logMissingDependentTableNames(List<Table> tables); static Map<String, List<String>> findMissingDependentTableNames(List<Table> tables); static void resolveForeignKeyOrder(Table t, Map<String, Table> allTables, Set<Table> resolved, Set<Table> temporary, 
            List<Table> finalList, Table parentTable, Map<Table, Set<String>> missingDependencyMap,
            Map<Integer, Set<Table>> dependencyMap, MutableInt depth, MutableInt position, 
            Map<Table, Integer> resolvedPosition, MutableInt parentPosition); static String printTables(List<Table> tables); static Table[] sortByForeignKeys(Table... tables); static List<Table> sortByForeignKeys(List<Table> tables); void mergeWith(Database otherDb); String getName(); void setName(String name); String getCatalog(); void setCatalog(String catalog); String getSchema(); void setSchema(String schema); String getVersion(); void setVersion(String version); String getIdMethod(); void setIdMethod(String idMethod); int getTableCount(); Table[] getTables(); Table getTable(int idx); void addTable(Table table); void addTable(int idx, Table table); void addTables(Collection<Table> tables); void addTables(Table[] tables); void removeTable(Table table); void removeTable(int idx); void initialize(); Table findTable(String name); Table findTable(String name, boolean caseSensitive); Table findTable(String catalogName, String schemaName, String tableName,
            boolean caseSensitive); Table findTable(String catalogName, String schemaName, String tableName); void resetTableIndexCache(); void removeAllTablesExcept(String... tableNames); Database copy(); Object clone(); boolean equals(Object obj); int hashCode(); String toString(); String toVerboseString();  }
@Test public void testRemoveAllTablesExcept() throws Exception { Database database = new Database(); database.addTable(new Table("SYM_DATA")); database.addTable(new Table("SYM_DOO_DADS")); assertEquals(2, database.getTableCount()); database.removeAllTablesExcept("SYM_DATA"); assertEquals(1, database.getTableCount()); assertNotNull(database.findTable("SYM_DATA")); }