Problem with LinkedList

hi, everyone. i have a problem with writing from a list. i've one such as

LinkedList list =new LinkedList();

list.add("one");

list.add("two");

System.out.println(list);

so i'm achieving such as that:

[one,two]. is there any way to achieve such as that:

one, two <without those brackets?please for any help,

king regards

[464 byte] By [alcatraz123a] at [2007-11-27 10:48:28]
# 1

Either write your own method, or use String's replace or replaceAll method to get rid of them.

jverda at 2007-7-28 22:26:58 > top of Java-index,Java Essentials,Java Programming...
# 2

ok thanks,

alcatraz123a at 2007-7-28 22:26:58 > top of Java-index,Java Essentials,Java Programming...
# 3

You are getting that beacuse you are printing the list itself. Try using a loop and going through the whole list using the get method see below:

LinkedList<String> list = new LinkedList<String>();

list.add("one");

list.add("two");

System.out.println(list);

for(String listVal : list){

System.out.print(listVal+ " ");

}

ita6cgra at 2007-7-28 22:26:58 > top of Java-index,Java Essentials,Java Programming...
# 4

i've tried it it works, thanks but one more thing from antoher subject:

i have string: "abracadabra"

now i'm checking if my string has "abra"

if(string.indexOf("what should i put here")>-1) then....

what should i put there, i'm too good in regex, thanks for advice

alcatraz123a at 2007-7-28 22:26:58 > top of Java-index,Java Essentials,Java Programming...
# 5

> i've tried it it works, thanks but one more thing

> from antoher subject:

>

> i have string: "abracadabra"

>

> now i'm checking if my string has "abra"

> > if(string.indexOf("what should i put here")>-1)

> then....

>

>

> what should i put there, i'm too good in regex,

> thanks for advice

Are you checking whether the beginning of the string has "abra" or whether "abra" is anywhere in the string?

ita6cgra at 2007-7-28 22:26:58 > top of Java-index,Java Essentials,Java Programming...