Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
bowbahdoe committed Sep 27, 2024
1 parent 622315b commit 2b97744
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions src/arrays_ii/populate_arrays.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,3 @@ for (int i = 0; i < letters.length; i++) {
System.out.println(letters);
~}
```

But if you are just writing some value to every index
without any other interesting logic, you can use `Arrays.fill`.

```java
~void main() {
int[] allNines = new int[123];
Arrays.fill(allNines, 9);

for (int i = 0; i < allNines.length; i++) {
System.out.println(allNines[i]);
}
~}
```

You give that the array and the value to fill it with. In the example above, the array starts
out with everything defaulted to `0` and is then filled with `9`s.

0 comments on commit 2b97744

Please sign in to comment.