Return a list with the same elements as v but in reverse order. Note that null values are not stripped out; use reverse(strip(v)) to do that.
(InstanceScope scope, Object v)
| 1052 | */ |
| 1053 | |
| 1054 | public Object reverse(InstanceScope scope, Object v) { |
| 1055 | if ( v==null ) return null; |
| 1056 | v = convertAnythingIteratableToIterator(scope, v); |
| 1057 | if ( v instanceof Iterator ) { |
| 1058 | List<Object> a = new LinkedList<Object>(); |
| 1059 | Iterator<?> it = (Iterator<?>)v; |
| 1060 | while ( it.hasNext() ) a.add(0, it.next()); |
| 1061 | return a; |
| 1062 | } |
| 1063 | return v; |
| 1064 | } |
| 1065 | |
| 1066 | /** |
| 1067 | * Return the length of a multi-valued attribute or 1 if it is a single |
no test coverage detected