• Post Reply Bookmark Topic Watch Topic
  • New Topic

debugging: what is a java syntax to static populate a List<String[]>  RSS feed

 
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how put in List string arrays, Sample Data, for debugging? what is a java syntax to static populate a List<String[]>?
 
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use something like this:

Note, however, that the List will have a fixed size: you can't add or remove elements from the list (if you do, you'll get an exception).
 
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or use a static block:


And if your List isn't static, the block doesn't have to be static either:
 
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then there is this monstrosity (which I find both repellent and endearing at the same time

 
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Beauty and the beast in one. (But you forgot the () ).
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fixed!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!