Eliminar fila de una tabla

Hola a todos.
Necesito eliminar de una tabla ciertas filas que cumplan con una conidicion. Necesito hacer esto ya que no puedo filtrar cuando creo el dataSource.
Quiero poder eliminar de la tabla (o del container) todas aquellas filas que cumplan un estado. Paso el codigo que tengo, pero me genera un error. En table.removeItem(item);
Desde ya muchisimas gracias.

public void eliminarEstados (){
Iterator<?> i = table.getContainerDataSource().getItemIds().iterator();
Item item;
while (i.hasNext()) {
Object key = i.next();
item= table.getContainerDataSource().getItem(key);

        Object value = item.getItemProperty("status").getValue();

        if (value.equals(1)){
            table.removeItem(item);
            //table.getContainerDataSource().removeItem(item);
        }
    }    
    
}

Este es el log del error:
[2017-11-09 20:48:33.679]
[1543636 ]
[http-nio-8090-exec-6]
(ERROR) com.inodes.hrdata.ui.sections.MenuLine - Provided id of the wrong type for class com.inodes.hrdata.entities.CaptureDevice. Expected: class java.lang.String, got class com.vaadin.data.hbnutil.HbnContainer$EntityItem
org.hibernate.TypeMismatchException: Provided id of the wrong type for class com.inodes.hrdata.entities.CaptureDevice. Expected: class java.lang.String, got class com.vaadin.data.hbnutil.HbnContainer$EntityItem
at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:135)

In Vaadin 7 you can get some errors, if your bean is not implemented correctly, see

https://vaadin.com/api/com/vaadin/data/util/BeanItemContainer.html

“BeanItemContainer uses the beans themselves as identifiers. The Object.hashCode() of a bean is used when storing and looking up beans so it must not change during the lifetime of the bean (it should not depend on any part of the bean that can be modified). Typically this restricts the implementation of Object.equals(Object) as well in order for it to fulfill the contract between equals() and hashCode().”

Also I would check what type your value is, so instead of using Object here Object value = item.getItemProperty(“status”).getValue(); cast it to right type, since otherwise you will have potential trouble with if (value.equals(1)) clasue.

Gracias por la respuesta. El tipo de dato es Integer. Y esa parte creo que la valida bien porque al if me entra.
lo veo cuando hago el debug el tema es en la linea en donde quiero eliminar.
Lo que quiero saber es si se puede, al igual que agregas columnas dinamicas para armar la tabla, si yo puedo borrar filas. Sin tocar el datasource digamos…u ocultarlas o algo…En la vista de la tabla

Hola, tal vez lo que necesitas es:

table.removeItem(key);