Example usage for java.util List contains

List of usage examples for java.util List contains

Introduction

In this page you can find the example usage for java.util List contains.

Prototype

boolean contains(Object o);

Source Link

Document

Returns true if this list contains the specified element.

Usage

From source file:com.l2jfree.network.mmocore.packethandlers.PacketDefinition.java

public static List<Class<?>> findClasses(Class<?> clazz) {
    while (clazz.getEnclosingClass() != null)
        clazz = clazz.getEnclosingClass();

    final List<Class<?>> classes = new ArrayList<Class<?>>();

    classes.add(clazz);/*  w  w  w.  j  ava 2  s.c  o m*/

    for (int i = 0; i < classes.size(); i++)
        for (Class<?> c : classes.get(i).getDeclaredClasses())
            if (!classes.contains(c))
                if (isInstanceable(c))
                    classes.add(c);

    return classes;
}

From source file:de.tor.tribes.util.VillageUtils.java

public static String[] getContinents(Village[] pVillages) {
    List<String> continents = new ArrayList<>();

    for (Village v : pVillages) {
        int cont = v.getContinent();
        String sCont = "K" + ((cont < 10) ? "0" + cont : cont);
        if (!continents.contains(sCont)) {
            continents.add(sCont);/*from w  ww . j  a va2s  .  c  o  m*/
        }
    }
    Collections.sort(continents, String.CASE_INSENSITIVE_ORDER);
    return continents.toArray(new String[continents.size()]);
}

From source file:com.htmlhifive.tools.codeassist.core.proposal.checker.CheckerUtils.java

/**
 * ???????./*from w  w  w  .  j a  va 2  s .com*/
 * 
 * @param bean 
 * @param codeAssistNode 
 * @return ????????
 */
static boolean checkCodeAssistNode(ObjectLiteralBean bean, CompletionOnMemberAccess codeAssistNode) {

    FunctionNameVisitor visitor = new FunctionNameVisitor();
    codeAssistNode.traverse(visitor);
    List<String> funcNames = visitor.getLastFunctionNames();
    if (funcNames.size() == 0) {
        return true;
    }
    FunctionBean[] elems = bean.getFunctions();
    for (FunctionBean elem : elems) {
        if (funcNames.contains(elem.getName())) {
            return true;
        }
    }
    return false;
}

From source file:de.huberlin.wbi.cuneiform.core.preprocess.PreListener.java

public static boolean containsParam(PrototypeContext prototype, String paramName) {

    List<String> nameList;

    nameList = getNameList(prototype);//from   w  w  w. ja  v a2s .  c  om
    return nameList.contains(paramName);
}

From source file:com.epam.ta.reportportal.events.handler.LaunchFinishedEventHandler.java

/**
 * Validate matching of finished launch name and project settings for
 * emailing/*  ww  w . j ava 2s  .co m*/
 *
 * @param launch  Launch to be evaluated
 * @param oneCase Mail case
 * @return TRUE if launch name matched
 */
static boolean isLaunchNameMatched(Launch launch, EmailSenderCase oneCase) {
    List<String> configuredNames = oneCase.getLaunchNames();
    return (null == configuredNames) || (configuredNames.isEmpty())
            || configuredNames.contains(launch.getName());
}

From source file:com.thoughtworks.go.util.ConfigUtil.java

public static List<String> allTasks(ConfigElementImplementationRegistry registry) {
    List<String> allTasks = new ArrayList<>();
    for (Class<? extends Task> task : registry.implementersOf(Task.class)) {
        AttributeAwareConfigTag attributeAwareConfigTag = task.getAnnotation(AttributeAwareConfigTag.class);
        if (attributeAwareConfigTag != null && !allTasks.contains(attributeAwareConfigTag.value())) {
            allTasks.add(attributeAwareConfigTag.value());
        }/*  w ww. j  a  va2 s  .c o  m*/
        ConfigTag tag = task.getAnnotation(ConfigTag.class);
        if (tag != null && !allTasks.contains(tag.value())) {
            allTasks.add(tag.value());
        }
    }
    return allTasks;
}

From source file:CollectionUtil.java

/**
 * Determines if the given lists contain the same elements. We suppose that all the elements of the given lists 
 * are different.//from   w ww . j ava 2 s. c o m
 * 
 * @param    firstList                The first list.
 * @param    secondList                The second list.
 * @return                         True if the given lists contain the same elements, false otherwise.
 */
public static boolean sameElements(List firstList, List secondList) {

    // The size hould be the same, otherwise stop.
    if (firstList.size() != secondList.size()) {
        return false;
    }

    // Iterate over the elements of the first list.
    for (int index = 0; index < firstList.size(); index++) {
        // Check if the element is also in the second list.
        if (!secondList.contains(firstList.get(index))) {
            return false;
        }
    }

    // They heve the same elements.
    return true;

}

From source file:cc.redpen.validator.ValidatorFactory.java

public static List<ValidatorConfiguration> getConfigurations(String lang) {
    List<ValidatorConfiguration> configurations = validators.entrySet().stream().filter(e -> {
        List<String> supportedLanguages = e.getValue().getSupportedLanguages();
        boolean deprecated = e.getValue().getClass().getAnnotation(Deprecated.class) == null ? false : true;
        return (supportedLanguages.isEmpty() || supportedLanguages.contains(lang)) && !deprecated;
    }).map(e -> new ValidatorConfiguration(e.getKey(), toStrings(e.getValue().getProperties())))
            .collect(toList());/*from   ww  w.  ja v a 2s.c o m*/
    Map<String, String> emptyMap = new LinkedHashMap<>();
    for (String jsValidator : jsValidators.keySet()) {
        try {
            Validator jsValidatorInstance = getInstance(jsValidator);
            List<String> supportedLanguages = jsValidatorInstance.getSupportedLanguages();
            if (supportedLanguages.isEmpty() || supportedLanguages.contains(lang)) {
                configurations.add(new ValidatorConfiguration(jsValidator, emptyMap));
            }
        } catch (RedPenException ignored) {
        }
    }
    return configurations;
}

From source file:de.arago.rike.commons.util.ViewHelper.java

public static List<String> getAvailableReleases() {
    DataHelperRike<Milestone> helper = new DataHelperRike<Milestone>(Milestone.class);

    List<String> releases = new ArrayList<String>();

    for (Milestone m : helper.list()) {
        if (m.getRelease() != null && !m.getRelease().isEmpty() && !releases.contains(m.getRelease())) {
            releases.add(m.getRelease());
        }/*  w  ww  .  ja  va2s  . c om*/
    }

    Collections.sort(releases);

    return releases;
}

From source file:com.innoq.ldap.connector.Utils.java

public static LdapUser updatedUser(LdapUser user, String name) {
    List<String> ocs = Arrays.asList(HELPER.getUserObjectClasses());
    user.setUid(name);//from  www  . ja v a 2s.  c om
    user.setPassword(name);
    user.set(HELPER.getUserIdentifyer(), name);
    if (ocs.contains("posixAccount")) {
        user.set("gecos", "User " + name);
        user.set("cn", name);
    }
    return user;
}