title: Set one variable of class when other variable is set?
body: <p>I retrieving data from json file and using gson to convert it to POJO class.
  I have two variable "<em>instancename</em>" and "<em>instanceid</em>" which i didn't get from json response. SO i have to set when i get list "Columns" value.</p>
  
  <pre><code>public class Row implements Serializable{
  @SerializedName("ElementInstanceID")
  @Expose
  private String elementInstanceID;
  @SerializedName("Columns")
  @Expose
  @Ignore
  private List&lt;String&gt; columns = null;
  
  private String roominstancename;
  
  private int roominstanceid;
  
  public Row(){
      Log.d("ROW","1");
      update();
  }
  
  public String getRoominstancename() {
      return roominstancename;
  }
  
  public void setRoominstancename(String roominstancename) {
      this.roominstancename = roominstancename;
  }
  
  public int getRoominstanceid() {
      return roominstanceid;
  }
  
  public void setRoominstanceid(int roominstanceid) {
      this.roominstanceid = roominstanceid;
  }
  
  
  public String getElementInstanceID() {
      return elementInstanceID;
  }
  
  public void setElementInstanceID(String elementInstanceID) {
      this.elementInstanceID = elementInstanceID;
  }
  
  public List&lt;String&gt; getColumns() {
      return columns;
  }
  
  
  
  public void setColumns(List&lt;String&gt; columns) {
      this.columns = columns;
      setInstance(columns);
  }
  
  public void setInstance(List&lt;String&gt; columns){
      setRoominstancename(columns.get(0));
      setRoominstanceid(Integer.parseInt(columns.get(1)));
  }
  
  public void update(){
      if (columns != null &amp;&amp; columns.size() &gt;= 0){
          setInstance(columns);
      }
  }
  
  @Override
  public String toString() {
      return "Element ID"+elementInstanceID;
  }
  }
  </code></pre>
  
  <p>Code to retrieve ROW object</p>
  
  <pre><code>final List&lt;Row&gt; rows = Arrays.asList(gson.fromJson(rowArray.toString(), Row[].class));
  </code></pre>
  
  <p>I am trying to update after i am getting list rows</p>
  
  <pre><code> for (Row row:rows) {
              row.update();
          }
  </code></pre>
  
  <p>Is there any way to make it efficient? </p>