Code example for Collection

Methods: size

0
            if (v != null) {
                if (v.getClass().isArray()) {
                    Object[] a = (Object[]) v;
                    return a.length;
                } else if (v instanceof Collection<?>) {
                    return ((Collection<?>) v).size();
                } else if (v instanceof HasFieldsList) {
                    return ((HasFieldsList) v).length();
                } else if (v instanceof JSONArray) {
                    return ((JSONArray) v).length();
                } else { 
                    String s = (v instanceof String ? (String) v : v.toString());
                    return s.length();
                } 
            } 
        } 
        return new EvalError(ControlFunctionRegistry.getFunctionName(this) + " expects an array or a string");
    } 
 
    @Override 
    public void write(JSONWriter writer, Properties options)