Java tutorial
//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 starting with specified input. * @param coll * @param str * @return Filtered Collection<String> */ public static Collection<String> startsWithString(Collection<String> coll, final String str) { Collection<String> list = new ArrayList<String>(); for (String item : coll) { if (item.startsWith(str)) { list.add(item); } } return list; } }