Java List Contain containsArgument(List argList, Option option)

Here you can find the source of containsArgument(List argList, Option option)

Description

contains Argument

License

Open Source License

Declaration

public static boolean containsArgument(List<String> argList, Option option) 

Method Source Code

//package com.java2s;
/*/*from   ww w  .j  a va  2s  .c  o m*/
 * JBoss, Home of Professional Open Source.
 * Copyright 2011, Red Hat, Inc., and individual contributors
 * as indicated by the @author tags. See the copyright.txt file in the
 * distribution for a full listing of individual contributors.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */

import org.kohsuke.args4j.Option;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Main {
    public static boolean containsArgument(List<String> argList, Option option) {
        List<String> options = new ArrayList<String>();
        options.add(option.name());
        options.addAll(Arrays.asList(option.aliases()));
        for (String s : options) {
            if (argList.contains(s))
                return true;
        }
        return false;
    }
}

Related

  1. containsAllIgnoreCase(List left, List right)
  2. containsAny(final String projectName, final List indicators)
  3. containsAny(List value, Object[] values)
  4. containsAny(Set theList, Set toSearch)
  5. containsAnyOf(Exception e, List nonRetryableKeywords)
  6. containsAtLeastAValue(List values)
  7. containsAtLeastOneElement(List l1, List l2)
  8. containsBasedOnEntryIdentity(final List list, final Object object)
  9. containsCaseInsensitive(String s, List l)