Reputation: 1111
ArrayList corresponds to repeated string:
message m1 {
repeated string mylist = 1;
}
How to define ArrayList< ArrayList< String> > in message? Thanks!
Upvotes: 1
Views: 2025
Reputation: 95704
You'll need another message to represent the inner List.
message M1 {
repeated M2 mylist = 1;
}
message M2 {
repeated string mylist = 1;
}
Of course, you may add as many fields as you'd like to M2, and you'll need some separate conversion logic to assemble the List<M2>
into an ArrayList<ArrayList<String>>
.
You may even want to create a reusable message to represent a list of strings:
message M1 {
repeated StringList mylist = 1;
}
message StringList {
repeated string value = 1;
}
Upvotes: 2