Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 0.63 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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" });