Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Can we get an arraylist from String.Please check the code.

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I have just pasted my code over here.Can anyone of you find the solution for obtaining the Array list from the String.

For Example :

ArrayList al = new ArrayList();
al.add(new byte[2]);
al.add("2");

String stringVar = "" + (ArrayList) al;

Here I can convert the arraylist into string.But can we do he vice versa like obtaining the above arraylist from the string?If please advice me.

URGENT!!!
 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no general way of transforming a String to a List; depending on your requirements there could be any number of ways. Can you give an example of a String you'd like to convert, and which elements the List should have after the conversion? It would be best if you could also describe in words how the transformation should work in the general case.
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

URGENT!!!



Why? Are you using this code for SCJP certification?

You have also duplicated this post in all three Java In General forums!
[ August 02, 2007: Message edited by: Barry Gaunt ]
reply
    Bookmark Topic Watch Topic
  • New Topic