Guest User

Untitled

a guest
May 5th, 2012
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. Append to 2-dimensional array
  2. String[][] headings = new String[][] { {
  3. "three",
  4. "three",
  5. "three"
  6. } };
  7.  
  8. String[][] headings = new String[][] { {
  9. "three",
  10. "three",
  11. "three"
  12. }, {} }; // note placeholder for to-be-added triplet.
  13. String val = condition ? "one": "two";
  14. headings[1] = new String[] {val, val, val};
  15.  
  16. ArrayList<String[]> headings = new ArrayList<String[]>();
  17. headings.add(new String[] { "three", "three", "three" });
  18.  
  19. if(/* condition */)
  20. headings.add(new String[] { "two", "two", "two" });
  21. else
  22. headings.add(new String[] { "one", "one", "one" });
Advertisement
Add Comment
Please, Sign In to add comment