Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {
    /**
     * Method to find if the given key is part of any of the array values
     * <p>
     * e.g. if array contains <i>"abc"</i> and given key is <i>"abcdef"</i>; true is returned
     * </p>
     * 
     * @param array
     *            Array to be scanned
     * @param key
     *            key
     * @return boolean true if partial key is found
     */
    public static boolean arrayContainsPartKey(String[] array, String key) {
        for (String string : array) {
            if (key.indexOf(string) != -1) {
                return true;
            }
        }
        return false;
    }
}