Return a new list without null values.
(InstanceScope scope, Object v)
| 1030 | /** Return a new list without {@code null} values. */ |
| 1031 | |
| 1032 | public Object strip(InstanceScope scope, Object v) { |
| 1033 | if ( v==null ) return null; |
| 1034 | v = convertAnythingIteratableToIterator(scope, v); |
| 1035 | if ( v instanceof Iterator ) { |
| 1036 | List<Object> a = new ArrayList<Object>(); |
| 1037 | Iterator<?> it = (Iterator<?>)v; |
| 1038 | while ( it.hasNext() ) { |
| 1039 | Object o = it.next(); |
| 1040 | if ( o!=null ) a.add(o); |
| 1041 | } |
| 1042 | return a; |
| 1043 | } |
| 1044 | return v; // strip(x)==x when x single-valued attribute |
| 1045 | } |
| 1046 | |
| 1047 | /** |
| 1048 | * Return a list with the same elements as {@code v} but in reverse order. |
no test coverage detected