If I have a method like this
private void setStringList(List<String> aList) { ... }
Then this is obviously possible
private void testOnly() {
List<String> myDummyList = new ArrayList<String>();
myDummyList.add("someValue");
setStringList(myDummyList);
}
but is there a way to make it less verbose like this
private void testOnly2() {
setStringList(new ArrayList<String>().add("someValue"));
}
I know above is compilation error but just showing to demonstrate what I want to achieve just to make it less verbose.
Aucun commentaire:
Enregistrer un commentaire