Question about the performance of Arrays.fill(boolean a, boolean val)
i found it was implemented as the follows code shows:
public static void fill(boolean a, boolean val)
?? ??? ?int i = 0, ??? = a.length; i < ???; i++?
a?i? = val?;
I wonder if this code is efficient enough, since i may use Arrays.fill(test, true), while the test array is quite large, for example, i defined test as new boolean, so it must iterate 100000000 times to initialize this test array, so i doubt this code with be efficient enough. Is there some underlying mechanism to ensure its efficiency? Then what is it? the compiler optimization technology? or sth else
I know C++ has a similar function named memset(void *s, int c, size_t n), its function is to make a block of memory to specific value, then what is the difference between memset and Arrays.fill(), may anyone give your view about this problem? thx
Message was edited by: wordperfect