You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by GitBox <gi...@apache.org> on 2021/07/28 13:11:42 UTC

[GitHub] [sling-org-apache-sling-scripting-sightly-runtime] kwin commented on a change in pull request #9: SLING-10679 wrap every object in a single item list

kwin commented on a change in pull request #9:
URL: https://github.com/apache/sling-org-apache-sling-scripting-sightly-runtime/pull/9#discussion_r678285787



##########
File path: src/main/java/org/apache/sling/scripting/sightly/render/ObjectModel.java
##########
@@ -308,12 +306,7 @@ public static String toString(Object object) {
             Iterable<Object> iterable = (Iterable<Object>) object;
             return fromIterator(iterable.iterator());
         }
-        if (object instanceof String || object instanceof Number) {
-            Collection<Object> list = new ArrayList<>();
-            list.add(object);
-            return list;
-        }
-        return Collections.emptyList();
+        return Collections.singletonList(object);

Review comment:
       The empty list being returned before was also immutable. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@sling.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org