On 22 July 2014 12:48, Gilles <[email protected]> wrote: > Hi. > > > On Mon, 21 Jul 2014 06:30:07 +0800, Fuxiang Chen wrote: >> >> Dear Developers, >> >> We are a team of researchers from the Hong Kong University of Science and >> Technology (HKUST). Currently, we are studying how crowdsourcing can help >> developers to build a higher quality software. >> >> One of the subjects that we used is Apache Commons Math. From our >> experiment, we identified a few areas in a particular file >> "TestUtils.java" >> that can be converted to a List<Type>. Using List<Type> is more preferred >> as it is much more flexible and easier to maintain. > > > Could you be more explicit about the issue you have with that class? > > >> The following 2 identified methods are able to convert to a List<Type>: >> 1) public static void assertChiSquareAccept(int[] values, double[] >> expected, long[] observed, double alpha) >> 2) public static void assertChiSquareAccept(double[] expected, long[] >> observed, double alpha) >> Both of the above methods have used String arrays, and can be converted to >> a List<String> instead. >> >> Our references from the Stack Overflow community pointed out that >> List<Type> is preferred over a Type array. >> The Stack Overflow references to this are at " >> http://stackoverflow.com/questions/8689246" and " >> http://stackoverflow.com/questions/716597". >> >> By converting the Type array to a List<Type>, this will make the code more >> flexible and easier to maintain. > > > It depends on usage. > Those methods are intended for internal purpose (they are defined in the > "test" sub-directory area of the code repository, whereas the public > functionality is in the "main" sub-directory. > What is your usage?
Note also that array and List are not binary compatible, so - in general - it's not possible to change without breaking the API. Of course, binary compat does not really matter for test code. > > Regards, > Gilles > >> [...] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
