Java Array Fill fillArray(Object[] array, Object value)

Here you can find the source of fillArray(Object[] array, Object value)

Description

Fills the array with a value.

License

Open Source License

Declaration

public static void fillArray(Object[] array, Object value) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from   ww  w . j ava 2 s. c  o  m
     * Fills the array with a value.
     */
    public static void fillArray(Object[] array, Object value) {

        int to = array.length;

        while (--to >= 0) {
            array[to] = value;
        }
    }

    /**
     * Fills the int array with a value
     */
    public static void fillArray(int[] array, int value) {

        int to = array.length;

        while (--to >= 0) {
            array[to] = value;
        }
    }
}

Related

  1. fillArray(int size, Float value)
  2. fillArray(int value, int length)
  3. fillArray(int[] array, int value)
  4. fillArray(int[] nums)
  5. fillArray(Object array, int value)
  6. fillArray(Object[] objects, Object object)
  7. fillArray(String value, int length)
  8. fillArray(String[] array, int size, String fillString)
  9. fillArray(T[] arr, T val)