Java Array Duplicate duplicateArrayEntries(String[] inputArr, int numDuplicates)

Here you can find the source of duplicateArrayEntries(String[] inputArr, int numDuplicates)

Description

duplicate Array Entries

License

Apache License

Declaration

public static String[] duplicateArrayEntries(String[] inputArr, int numDuplicates) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.ArrayList;

import java.util.List;

public class Main {
    public static String[] duplicateArrayEntries(String[] inputArr, int numDuplicates) {
        List<String> list = new ArrayList<String>();
        for (String d : inputArr) {
            for (int i = 0; i < numDuplicates; i++) {
                list.add(d);/*from  w w w.j  a v  a2 s .  co  m*/
            }
        }

        return list.toArray(new String[0]);
    }
}

Related

  1. addNoDuplicate(String[] array, String target)
  2. arrayDuplicate(byte[] in)
  3. deleteDuplicatedPages(int[] pages)
  4. eraseDuplicatedValue(String[] srcArr)
  5. hasDuplicates(final T[] array)
  6. isDuplicated(String[] strArray)
  7. removeDuplicates(double[] array)