Java Array Normalize normalizeArray(String[] raw, int expectedSize)

Here you can find the source of normalizeArray(String[] raw, int expectedSize)

Description

normalize Array

License

LGPL

Declaration

public static String[] normalizeArray(String[] raw, int expectedSize) 

Method Source Code


//package com.java2s;
/*/*from   w w  w.ja  v a 2 s  .co  m*/
 * This class was created by <AdrianTodt>. It's distributed as
 * part of the DavidBot. Get the Source Code in github:
 * https://github.com/adriantodt/David
 *
 * DavidBot is Open Source and distributed under the
 * GNU Lesser General Public License v2.1:
 * https://github.com/adriantodt/David/blob/master/LICENSE
 *
 * File Created @ [01/11/16 13:23]
 */

import java.util.*;

public class Main {
    public static String[] normalizeArray(String[] raw, int expectedSize) {
        String[] normalized = new String[expectedSize];

        Arrays.fill(normalized, "");
        for (int i = 0; i < normalized.length; i++) {
            if (i < raw.length && raw[i] != null && !raw[i].isEmpty()) {
                normalized[i] = raw[i];
            }
        }
        return normalized;
    }
}

Related

  1. normalize2(double[] x)
  2. normalize3(float[] result, float[] a)
  3. normalizeAndInvertValues(double[] values, double maxValue, double minValue)
  4. normalizeArray(double[] array)
  5. normalizeArray(double[] hist)
  6. normalizeArrays(int normalizeToLength, String[]... arraysToNormalize)
  7. normalizeCharacterData(char[] ch, int start, int length)
  8. normalizeComplexVectorsToUnitVectors(float[] complex)
  9. normalizeComponentsOverwrite(float[][][][] in)