public Frame() { Objects a = new Objects(); a.addStudents(); // <-- calling this method will initialize your list list = a.getList(); }
public Frame() { Objects a = new Objects(); //<-- new object of type Objects list = a.getList(); //<-- call getList but list is null }
Objects object = new Objects(); //assuming Objects implements Serializable bundle.putSerializable("blahblah", object);
if( obj.dst(Game.WIDTH , Game.HEIGHT) <= closeEnough ){ obj = new Objects(); }
public static void main(String [] args) { // add correct arguments //.. ArrayList <Integer> xcoords = (new Objects()).xco(); for( int x = 0 ; x < xcoords.size() ; x++ ) { // start from index 0 System.out.println(xcoords.get(x)); } }
class ObjectsDeserializer implements JsonDeserializer<Objects> { @Override public Objects deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { JsonObject jsonObject = json.getAsJsonObject().getAsJsonObject("Objects"); List<NestedObject1> list = new ArrayList<>(); for(Map.Entry<String, JsonElement> entry : jsonObject.entrySet()) { List<NestedObject2> nestedObject2List = new ArrayList<>(); //here deserialize each NestedObject2 and put it in the list list.add(new NestedObject1(entry.getKey(), nestedObject2List)); } return new Objects(list); } }