GList.write
ci/woodpecker/push/woodpecker Pipeline was successful
Details
ci/woodpecker/push/woodpecker Pipeline was successful
Details
This commit is contained in:
parent
0fc1d3bce6
commit
dd1b457bc8
|
@ -1,12 +1,13 @@
|
|||
package io.gitlab.jfronny.gson.compile.util;
|
||||
|
||||
import io.gitlab.jfronny.commons.throwable.ThrowingBiConsumer;
|
||||
import io.gitlab.jfronny.commons.throwable.ThrowingFunction;
|
||||
import io.gitlab.jfronny.gson.stream.JsonReader;
|
||||
import io.gitlab.jfronny.gson.stream.JsonToken;
|
||||
import io.gitlab.jfronny.gson.stream.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
/**
|
||||
* Utility class for generating lists, to be used when data with an array root element
|
||||
|
@ -25,4 +26,10 @@ public class GList {
|
|||
reader.endArray();
|
||||
return res;
|
||||
}
|
||||
|
||||
public static <T> void write(JsonWriter writer, List<T> list, ThrowingBiConsumer<JsonWriter, T, IOException> write) throws IOException {
|
||||
writer.beginArray();
|
||||
for (T t : list) write.accept(writer, t);
|
||||
writer.endArray();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue