If I attempt to create a table like:
r.tableCreate("mytable").optArg("primary_key", "id").run(conn);
It will throw an exception if mytable already exists.
My question is simple: is there a more appropriate procedure to determine whether a table already exists other than try/catch the exception? E.g. a method returning a boolean value or a method that creates only if not exists.
Thank you for your attention
edit: regarding this answer, the methods r.dbList() and r.tableList() did not return any information regarding the tables. In line with this, the methods r.tableList().contains() and r.dbList().contains() do not return an answer to my question. Note that I am using the following Java lib:
<dependency>
<groupId>com.rethinkdb</groupId>
<artifactId>rethinkdb-driver</artifactId>
<version>2.3.3</version>
</dependency>
and I am not sure if the above-mentioned methods from this library are meant to be equivalent to those mentioned in this answer.