How to convert String representation of ArrayList to ArrayList
<p>I have an ArrayList, Whom i convert to String like</p>

<pre><code>ArrayList str = (ArrayList) retrieveList.get(1);
...

makeCookie("userCredentialsCookie", str.toString(), httpServletResponce);
....

private void makeCookie(String name, String value, HttpServletResponse response) {

    Cookie cookie = new Cookie(name, value);
    cookie.setPath("/");
    response.addCookie(cookie);

} //end of makeCookie()
</code></pre>

<p>Now when i retrieve cookie value, i get String, but i again want to convert it into ArrayList like</p>

<pre><code>private void addCookieValueToSession(HttpSession session, Cookie cookie, String attributeName) {       
    if (attributeName.equalsIgnoreCase("getusercredentials")) {

        String value = cookie.getValue();
        ArrayList userCredntialsList = (ArrayList)value;  //Need String to ArrayList 
        session.setAttribute(attributeName, userCredntialsList);
        return;
    }

    String value = cookie.getValue();
    session.setAttribute(attributeName, value);

} //end of addCookieValueToSession
</code></pre>

<p>How can i again convert it to ArrayList? 
Thank you.</p>
