Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.net.Uri;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

public class Main {
    public static final String TABLE = "table";

    public static List<String> getAllTables(Uri uri) {
        List<String> result = new ArrayList<String>();

        String mainTable = uri.getLastPathSegment();
        result.add(mainTable);

        Set<String> queryParameterNames = uri.getQueryParameterNames();
        Iterator<String> iterator = queryParameterNames.iterator();
        while (iterator.hasNext()) {
            String table = iterator.next();
            if (table.startsWith(TABLE)) {
                result.add(table.replaceFirst(TABLE, ""));
            }
        }
        return result;
    }
}