public void filter(IPredicate<? super E> predicate) {
    	// It is typically faster to copy the allowed elements in a new list
    	// than to remove the not allowed from the existing one
    	IList<E> list = doCreate(-1);
		int size = size();
		for (int i=0; i<size; i++) {
			E e = doGet(i);
    		if (predicate.test(e)) {
    			list.add(e);
    		}
    	}
    	doAssign(list);
    }
Filter the list using the specified predicate.
Only element which are allowed remain in the list, the others are removed

@param predicate predicate used for filtering
jphp-runtime/src/php/runtime/memory/support/IList.java