string - When writing junit test cases, which one of the following is best to use for empty list? -


when writing junit test cases, 1 of following best use empty list ?

list<string> list = new arraylist<string>(); 

or

collections.<string> emptylist(); 

?

whenever possible prefer collections.emptylist() on arraylist, because ensures main code doesn’t try modify given list, in cases correct behavior.

in practice use guava’s immutablelist, since covers not empty lists nonempty ones.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -