I have a class with a list of lists field as below:
JavaScript
x
public class MyClass{
private List<List<String>>
}
how to define it in a proto file?
Advertisement
Answer
- You can declare your own “types” in proto files called message.
- If you’d like to declare a list you should use repeated keyword.
Combining those two gives us:
JavaScript
message ListOfListsOfStrings {
repeated ListOfStrings listOfStrings=1;
}
message ListOfStrings {
repeated string strings=1;
}
You can then use ListOfListsOfStrings message in your proto were appropriate.