File tree Expand file tree Collapse file tree
xapi-client/src/main/java/dev/learning/xapi/client Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -164,14 +164,16 @@ private List<Object> getParts(Object object) {
164164
165165 final var list = new ArrayList <>();
166166
167- Stream <Attachment > attachments ;
168- if (object instanceof final Statement statement ) {
169- attachments = getRealAttachments (statement );
170- } else if (object instanceof final List <?> statements
171- && !statements .isEmpty ()
172- && statements .get (0 ) instanceof Statement ) {
173- attachments = ((List <Statement >) statements ).stream ().flatMap (this ::getRealAttachments );
174- } else {
167+ final Stream <Attachment > attachments =
168+ switch (object ) {
169+ case Statement statement -> getRealAttachments (statement );
170+ case List <?> statements
171+ when !statements .isEmpty () && statements .get (0 ) instanceof Statement ->
172+ ((List <Statement >) statements ).stream ().flatMap (this ::getRealAttachments );
173+ default -> null ;
174+ };
175+
176+ if (attachments == null ) {
175177 // The object is not a statement or list of statements
176178 return list ;
177179 }
You can’t perform that action at this time.
0 commit comments