Return a new list without null values.
(InstanceScope scope, Object v)
| 1064 | /** Return a new list without {@code null} values. */ |
| 1065 | |
| 1066 | public Object strip(InstanceScope scope, Object v) { |
| 1067 | if ( v==null ) return null; |
| 1068 | v = convertAnythingIteratableToIterator(scope, v); |
| 1069 | if ( v instanceof Iterator) { |
| 1070 | List<Object> a = new ArrayList<Object>(); |
| 1071 | Iterator<?> it = (Iterator<?>)v; |
| 1072 | while ( it.hasNext() ) { |
| 1073 | Object o = it.next(); |
| 1074 | if ( o !=null ) a.add(o); |
| 1075 | } |
| 1076 | return a; |
| 1077 | } |
| 1078 | return v; // strip(x)==x when x single-valued attribute |
| 1079 | } |
| 1080 | |
| 1081 | /** |
| 1082 | * Return a list with the same elements as {@code v} but in reverse order. |
no test coverage detected