class ListContainsFunction extends BaseFEELFunction {

    public FEELFnResult<Boolean> invoke(@ParameterName("list") List list, @ParameterName("element") Object element) {
        if ( list == null ) {
            return FEELFnResult.ofError(new InvalidParametersEvent(Severity.ERROR, "list", "cannot be null"));
        } else {
            if (element == null) {
                return FEELFnResult.ofResult(list.contains(element));
            } else {
                Object e = EvalHelper.coerceNumber(element);
                boolean found = false;
                ListIterator<?> it = list.listIterator();
                while (it.hasNext() && !found) {
                    Object next = EvalHelper.coerceNumber(it.next());
                    found = e.equals(next);
                }
                return FEELFnResult.ofResult(found);
            }
        }
    }

    public  ListContainsFunction();

}