Java tutorial
//package com.java2s; import java.util.Collection; import java.util.List; import java.util.ArrayList; import org.springframework.beans.BeanWrapper; import org.springframework.beans.BeanWrapperImpl; public class Main { public static Collection<?> filterByNotValue(String propertyName, Object value, Collection<?> collection) { List<Object> list = new ArrayList<Object>(collection.size()); for (Object o : collection) { BeanWrapper bw = new BeanWrapperImpl(o); Object propertyValue = bw.getPropertyValue(propertyName); if (!propertyValue.equals(value)) { list.add(o); } } return list; } }