Function that check's file type based on certain keywords I have a function that breaks up a source file and checks each token against a keyword list to determine whether its a particular file type. How can I improve this function? Tokenization is a class that contains a function to break up the source code.

public static boolean validationTypeOfSQL(String sourceFile, Tokenization tokenization,ArrayList&lt;String&gt; uniqueKeywordList) {
    ArrayList&lt;Token&gt; createSourceCodeTokens = tokenization.createSourceCodeTokens(sourceFile);

    for (Token x : createSourceCodeTokens) {
        String smallerTokens[] = tokenization.tokenToSmallerToken(x.getToken());
        for (String smallerTOkenValue : smallerTokens) {
            Boolean result = smallerTOkenValue.contains(",");
            if (result == true) {
                String[] tokenSplit = smallerTOkenValue.split(",");
                for (String ts : tokenSplit) {
                    for (String t : uniqueKeywordList) {
                        if (t.toLowerCase().equals(ts.toLowerCase().replace("(", "").replace(",", "").replace(")", "").replace("\t", ""))) {
                            // System.out.println("This is a mysql file Mysql");
                            return true;
                        }
                    }
                }
            }
            else {
                for (String uniqueKeyword : uniqueKeywordList) {
                    if (uniqueKeyword.toLowerCase().equals(smallerTOkenValue.toLowerCase().replace("(", "").replace(",", "").replace(")", ""))) 
                    {
                        return true;
                    }
                }
            }
        }

    }
    return false;
}
Regarding your naming:

I'd rename:


validationTypeOfSQL() to isSQL() 
createSourceCodeTokens to sourceCodeTokens
createSourceCodeTokens() to sourceCodeTokens()
x to token
tokenToSmallerToken() to smallerTokens()
smallerTOkenValue to smallerToken
result to containsComma (It's better, of course, to remove it completely according to Robert Snyder's answer.)
tokenSplit to splitTokens
ts to st or splitToken
t to k or keyword
uniqueKeyword to keyword


I'd change String smallerTokens[] to String[] .... as you write it 4 lines later anyway.

I' d use replaceAll(String regex, String replacement) with replaceAll("[(,)\t]", "") instead of the replace() chain.