Skip to content

Commit

Permalink
style: use Document.ListBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
WinterYukky committed Oct 31, 2023
1 parent e0be1dd commit 20a8621
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.document.Document;
import software.amazon.awssdk.core.document.Document.ListBuilder;
import software.amazon.awssdk.core.document.Document.MapBuilder;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.ListTrait;
Expand Down Expand Up @@ -219,11 +220,11 @@ private Document readDocument(SdkField<?> field, JsonParser p, DeserializationCo
case VALUE_NUMBER_INT:
return Document.fromNumber(p.getText());
case START_ARRAY: {
List<Document> documents = new ArrayList<>();
ListBuilder builder = Document.listBuilder();
while (p.nextToken() != JsonToken.END_ARRAY) {
documents.add(readDocument(field, p, ctxt));
builder.addDocument(readDocument(field, p, ctxt));
}
return Document.fromList(documents);
return builder.build();
}
case START_OBJECT:
MapBuilder builder = Document.mapBuilder();
Expand Down

0 comments on commit 20a8621

Please sign in to comment.