//snippet-sourcedescription:[ListTables.java demonstrates how to list all AWS DynamoDB tables]
//snippet-keyword:[SDK for Java 2.0]
//snippet-keyword:[Code Sample]
//snippet-service:[dynamodb]
//snippet-sourcetype:[full-example]
//snippet-sourcedate:[2/5/2020]
//snippet-sourceauthor:[soo-aws]

/*
   Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   This file is licensed under the Apache License, Version 2.0 (the "License").
   You may not use this file except in compliance with the License. A copy of
   the License is located at
    http://aws.amazon.com/apache2.0/
   This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
   CONDITIONS OF ANY KIND, either express or implied. See the License for the
   specific language governing permissions and limitations under the License.
*/

package com.example.dynamodb;
// snippet-start:[dynamodb.java2.list_tables.complete]
// snippet-start:[dynamodb.java2.list_tables.import]
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.dynamodb.model.DynamoDbException;
import software.amazon.awssdk.services.dynamodb.model.ListTablesResponse;
import software.amazon.awssdk.services.dynamodb.model.ListTablesRequest;
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
import java.util.List;
// snippet-end:[dynamodb.java2.list_tables.import]

/**
 * Lists AWS DynamoDB tables for the current AWS account.
 *
 * This code expects that you have AWS credentials set up, as described here:
 * http://docs.aws.amazon.com/java-sdk/latest/developer-guide/setup-credentials.html
 */
public class ListTables {

    public static void main(String[] args) {

        System.out.println("Your DynamoDB tables:\n");

        // snippet-start:[dynamodb.java2.list_tables.main]

        // Create the DynamoDbClient object
        Region region = Region.US_WEST_2;
        DynamoDbClient ddb = DynamoDbClient.builder().region(region).build();

        boolean moreTables = true;
        String lastName = null;

        while(moreTables) {
            try {
                ListTablesResponse response = null;
                if (lastName == null) {
                    ListTablesRequest request = ListTablesRequest.builder().build();
                    response = ddb.listTables(request);
                } else {
                    ListTablesRequest request = ListTablesRequest.builder()
                            .exclusiveStartTableName(lastName).build();
                    response = ddb.listTables(request);
                }

                List<String> tableNames = response.tableNames();

                if (tableNames.size() > 0) {
                    for (String curName : tableNames) {
                        System.out.format("* %s\n", curName);
                    }
                } else {
                    System.out.println("No tables found!");
                    System.exit(0);
                }

                lastName = response.lastEvaluatedTableName();
                if (lastName == null) {
                    moreTables = false;
                }
            } catch (DynamoDbException e) {
                System.err.println(e.getMessage());
                System.exit(1);
            }
        }
        // snippet-end:[dynamodb.java2.list_tables.main]
        System.out.println("\nDone!");
    }
}
// snippet-end:[dynamodb.java2.list_tables.complete]

@@ -185,18 +185,18 @@
 :%5Bdynamo
-db
+DB
 %5D%0D%0A//sni
@@ -285,18 +285,23 @@
 uthor:%5Bs
-oo
+cmacdon
 -aws%5D%0D%0A%0D
@@ -322,18 +322,8 @@
 ght 
-2010-2020 
 Amaz
@@ -875,62 +875,8 @@
 b;%0D%0A
-// snippet-start:%5Bdynamodb.java2.list_tables.complete%5D
 %0D%0A//
@@ -1717,70 +1717,8 @@
 %0D%0A%0D%0A
-        // snippet-start:%5Bdynamodb.java2.list_tables.main%5D%0D%0A%0D%0A
     
@@ -1796,14 +1796,14 @@
 .US_
-W
 E
+A
 ST_
-2
+1
 ;%0D%0A 
@@ -1875,24 +1875,177 @@
 n).build();%0D
+%0A        listAllTables(ddb);%0D%0A    %7D%0D%0A%0D%0A    // snippet-start:%5Bdynamodb.java2.list_tables.main%5D%0D%0A    public static void listAllTables(DynamoDbClient ddb)%7B%0D
 %0A%0D%0A        b
@@ -3480,58 +3480,4 @@
 %0A%7D%0D%0A
-// snippet-end:%5Bdynamodb.java2.list_tables.complete%5D%0D%0A

Update ListTables.java