Need to pass a String array to a Set
<p>Hello guys I need to pass a string array over to a setter that takes a Set. Not sure how to pass it over. Thanks</p>

<p>THis is my form:</p>

<pre><code>  public String[] getFields() { return fields; }
public void setFields(String[] s) 
{ 
    fields = s; 
    //System.out.println("form Array length " + s.length);  
}
</code></pre>

<p>and here is the bean:</p>

<pre><code>private Set&lt;DetFieldBean&gt; fields;

   public void setFields( Collection&lt;DetFieldBean&gt; val )
{
    // allow other types of Collections to be passed in
    // however, make sure we are using the impl we want
    if( fields == null ) fields = new HashSet&lt;DetFieldBean&gt;();
    fields.addAll( val );
}
</code></pre>

<p>Action code:</p>

<pre><code>DetParameterBean paramBean = new DetParameterBean();  //New Bean
form.getFields()  //String Array

        paramBean.setFields(Arrays.asList(form.getFields()));  //Need bean set here
</code></pre>

<p>got a message that stated: The method setFields(Collection) in the type DetParameterBean is not applicable for the arguments (List)</p>

<p>detParameterBean</p>

<pre><code>public class DetParameterBean
extends AbstractBean
{
private Set&lt;DetFieldBean&gt; fields;
private List&lt;DetFilterCriteriaBean&gt; filters;
private int groupLevel;

public DetParameterBean() { }

public Set&lt;DetFieldBean&gt; getFields() { return this.fields; } 
public List&lt;DetFilterCriteriaBean&gt; getFilterCriteria() { return this.filters; }
public int getGroupLevel() { return this.groupLevel; }

public String[] getFieldNames() 
{
    String[] result = null;

    if( fields != null ) 
    {
        result = new String[fields.size()];
        int r = 0;
        for( DetFieldBean field : fields ) result[r++] = field.getFieldName();
    }
    return result;
}

public void setFields( Collection&lt;DetFieldBean&gt; val )
{
    // allow other types of Collections to be passed in
    // however, make sure we are using the impl we want
    if( fields == null ) fields = new HashSet&lt;DetFieldBean&gt;();
    fields.addAll( val );
}

public void setFilterCriteria(List&lt;DetFilterCriteriaBean&gt; val) { this.filters = val; }
public void setFilterCriteria(Collection&lt;DetFilterCriteriaBean&gt; val) 
{ 
    if( this.filters == null ) this.filters = new ArrayList&lt;DetFilterCriteriaBean&gt;(); 
    this.filters.addAll( val ); 
}

public void setGroupLevel(int val) { this.groupLevel = val; }

public boolean addField(DetFieldBean field) 
{ 
    if( fields == null ) fields = new HashSet&lt;DetFieldBean&gt;();
    return fields.add(field); 
}
public void addFilter( DetFilterCriteriaBean val )
{
    if( filters == null ) filters = new ArrayList&lt;DetFilterCriteriaBean&gt;();
    filters.add(val);
}
</code></pre>
