Return a new list without null values.
(InstanceScope scope, Object v)
| 1011 | /** Return a new list without {@code null} values. */ |
| 1012 | |
| 1013 | public Object strip(InstanceScope scope, Object v) { |
| 1014 | if ( v==null ) return null; |
| 1015 | v = convertAnythingIteratableToIterator(scope, v); |
| 1016 | if ( v instanceof Iterator ) { |
| 1017 | List<Object> a = new ArrayList<Object>(); |
| 1018 | Iterator<?> it = (Iterator<?>)v; |
| 1019 | while ( it.hasNext() ) { |
| 1020 | Object o = it.next(); |
| 1021 | if ( o!=null ) a.add(o); |
| 1022 | } |
| 1023 | return a; |
| 1024 | } |
| 1025 | return v; // strip(x)==x when x single-valued attribute |
| 1026 | } |
| 1027 | |
| 1028 | /** |
| 1029 | * Return a list with the same elements as {@code v} but in reverse order. |
no test coverage detected