Java - Write code to Given a string check to see if it is in a collection of strings (using equals())

Requirements

Write code to Given a string check to see if it is in a collection of strings (using equals())

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String searchString = "book2s.com";
        String searchStringList = "book2s.com";
        System.out.println(in(searchString, searchStringList));
    }//from   ww  w  . j  a  v a 2s  . com

    public static boolean in(final String searchString,
            final String... searchStringList) {
        if (searchString == null) {
            return false;
        }
        if (searchStringList.length == 0) {
            throw new IllegalArgumentException(
                    "argument SearchStringList must have length > 0");
        }

        for (final String s : searchStringList) {
            if (s.equals(searchString)) {
                return true;
            }
        }
        return false;
    }
}