Skip to content

Instantly share code, notes, and snippets.

@ashwanthkumar
Last active August 29, 2015 13:56
Show Gist options
  • Save ashwanthkumar/8949926 to your computer and use it in GitHub Desktop.
Save ashwanthkumar/8949926 to your computer and use it in GitHub Desktop.
struct Vehicle {
1: string name
2: string model
}
struct Person {
1: string name
2: i32 age
// Empty collections can be specified using []. Same works for map and set as well.
3: list<Vehicle> cars = []
// Another way to specify default empty values
4: list<Vehicle> bikes = empty
}
// Reference - http://stackoverflow.com/a/12501037
struct Family {
1: Person familyHead = {"name": "Father", "age":60}
}
....
@Override
public void clear() {
this.familyHead = new Person();
this.familyHead.setName("Father");
this.familyHead.setAge(60);
}
....
....
@Override
public void clear() {
this.name = null;
setAgeIsSet(false);
this.age = 0;
this.cars = new ArrayList<Vehicle>();
this.bikes = new ArrayList<Vehicle>();
}
....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment