Java Array Fill fillArray(String[] array, int size, String fillString)

Here you can find the source of fillArray(String[] array, int size, String fillString)

Description

fill Array

License

Open Source License

Declaration

public static String[] fillArray(String[] array, int size, String fillString) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String[] fillArray(String[] array, int size, String fillString) {

        if (array == null) {
            return null;
        }//from  www .j  a  v a  2  s  . c om

        String[] fillArray = new String[size];

        for (int index = 0; index < fillArray.length; index++) {
            String fillValue = fillString;
            if (index < array.length) {
                fillValue = array[index];
            }
            fillArray[index] = fillValue;
        }

        return fillArray;
    }
}

Related

  1. fillArray(int[] nums)
  2. fillArray(Object array, int value)
  3. fillArray(Object[] array, Object value)
  4. fillArray(Object[] objects, Object object)
  5. fillArray(String value, int length)
  6. fillArray(T[] arr, T val)
  7. fillArray2D(double[][] arr, double value)
  8. fillArrayWith(byte[] dest, byte[] pattern)
  9. fillArrayWithByte(byte[] array, byte value)