java : Need help converting an Object to Array
<p>I have this Userlist Object with some data in it </p>

<pre><code>Userlist userlist = new Userlist();
userlist.setUserlistItem(userlistitem);
</code></pre>

<p>Now  i have another Object UserDatalists  , the structure of  UserDatalists is shown below </p>

<pre><code>public class UserDatalists{

    private Userlist[] userlist;

    public Userlist[] getUserlist() {
        return userlist;
    }

    public void setUserlist(Userlist[] userlist) {
        this.userlist = userlist;
    }

}
</code></pre>

<p>As you can see that the UserDatalists Object accepts an array of Userlist .</p>

<p>Please tell me how can i convert the Userlist  to an array , so that i can set it inside the UserDatalists</p>

<pre><code>public class Userlist {

    private static final long serialVersionUID = 1L;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public UserlistItem[] getUserlistItem() {
        return UserlistItem;
    }

    public void setUserlistItem(UserlistItem[] userlistItem) {
        UserlistItem = userlistItem;
    }

    private String id;
    private UserlistItem[] UserlistItem;

}






 public class UserDatalists {

        private Userlist[] userlist;

        public Userlist[] getUserlist() {
            return userlist;
        }

        public void setUserlist(Userlist[] userlist) {
            this.userlist = userlist;
        }

    }
</code></pre>
