Java - Write code to check if a string equals to Any string inside an String array

Requirements

Write code to check if a string equals to Any string inside an String array

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        String stringToMatch = "book2s.com";
        String stringToCheckEquals = "book2s.com";
        System.out.println(equalsAny(stringToMatch, stringToCheckEquals));
    }/*  w w  w  . ja  v a  2s.c o m*/

    public static boolean equalsAny(String stringToMatch,
            String... stringToCheckEquals) {
        for (final String candidate : stringToCheckEquals) {
            if (stringToMatch.equals(candidate)) {
                return true;
            }
        }
        return false;
    }
}