Java List Contain containsColumnByAlias(List columns, String alias)

Here you can find the source of containsColumnByAlias(List columns, String alias)

Description

contains Column By Alias

License

Apache License

Declaration

public static boolean containsColumnByAlias(List<String> columns, String alias) 

Method Source Code

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

import java.util.List;

public class Main {
    public static final String AS = " as ";

    public static boolean containsColumnByAlias(List<String> columns, String alias) {
        for (String column : columns) {
            if (getColumnAlias(column).equals(alias)) {
                return true;
            }/*from   w  w  w. j a v  a 2 s  .c om*/
        }
        return false;
    }

    public static String getColumnAlias(String fullColumnName) {
        if (fullColumnName.contains(AS)) {
            int index = fullColumnName.indexOf(AS);
            return fullColumnName.substring(index + AS.length());
        } else {
            return fullColumnName;
        }
    }
}

Related

  1. containsArgument(List argList, Option option)
  2. containsAtLeastAValue(List values)
  3. containsAtLeastOneElement(List l1, List l2)
  4. containsBasedOnEntryIdentity(final List list, final Object object)
  5. containsCaseInsensitive(String s, List l)
  6. containsDuplicates(List list, Comparator comparator)
  7. containsElement( List> list, List element)
  8. containsEnchantment(String enchantments, List enchList)
  9. containsExactly(Collection list, T... mustHaveItems)