Java tutorial
//package com.java2s; import java.util.Collection; import java.util.HashSet; import java.util.Set; public class Main { public static <T> Set<Class<? extends T>> filter(Collection<Class<? extends T>> source, String packageFilter) { Set<Class<? extends T>> filtered = new HashSet<Class<? extends T>>(); for (Class<? extends T> klazz : source) { if (klazz.getName().startsWith(packageFilter)) filtered.add(klazz); } return filtered; } }