Java HashSet Create convertHashSetIntoArray(HashSet cdsidsSet)

Here you can find the source of convertHashSetIntoArray(HashSet cdsidsSet)

Description

Eliminate duplicate CDSIDs

License

Open Source License

Parameter

Parameter Description
cdsidsSet a parameter

Declaration

public static String[] convertHashSetIntoArray(HashSet<String> cdsidsSet) 

Method Source Code

//package com.java2s;

import java.util.HashSet;
import java.util.Iterator;

public class Main {
    /**// w w w  .  j a  v a2s  .  c  o m
     * Eliminate duplicate CDSIDs
     * @param cdsidsSet
     * @return
     */
    public static String[] convertHashSetIntoArray(HashSet<String> cdsidsSet) {

        String[] cdsids = new String[cdsidsSet.size()];
        if (cdsidsSet.size() > 0) {
            Iterator it = cdsidsSet.iterator();
            int x = 0;
            while (it.hasNext()) {
                cdsids[x++] = (String) it.next();
            }
        }
        return cdsids;
    }
}

Related

  1. asHashSet(@SuppressWarnings("unchecked") T... elements)
  2. asHashSet(Set set)
  3. asHashSet(T... elements)
  4. createHashSet(T... arr)
  5. hashSet()
  6. hashSet()
  7. hashset_to_int_array(Set hs)