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
Post a Comment