I am working on a large project in which the functions I want to use, accept data in the form of List< Result< Record >> and then send it to frontend or convert to csv.
I am receiving data in the form of List< Object > and I want to convert data from List< Object > to List< Result< Record >>. How to do it?
public class Object {
int x;
string str;
float f;
}
You can create in-memory Result
values using DSLContext.newResult()
and DSLContext.newRecord()
like this:
Field<Integer> x = ...;
Field<String> str = ...;
Field<Float> f = ...;
Result<Record3<Integer, String, Float>> r = ctx.newResult(x, str, f);
for (Object o : list)
r.add(ctx.newRecord(x, str, f).values(o.x, o.str, o.f));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.