Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.ArrayList;
import java.util.Collection;

public class Main {
    /**
     * This function filters the input collection and returns a collection of elements containing the specified input (Ignore Case).
     * @param coll
     * @param str
     * @return Filtered Collection<String>
     */
    public static Collection<String> containsStringIgnoreCase(Collection<String> coll, final String str) {
        Collection<String> list = new ArrayList<String>();
        for (String item : coll) {
            if (item.toLowerCase().contains(str.toLowerCase())) {
                list.add(item);
            }
        }
        return list;
    }
}