Using java.util.Collections in GWT application

632 views
Skip to first unread message

fjarenales

unread,
Dec 27, 2011, 3:16:51 AM12/27/11
to Google Web Toolkit
Hi folks,

I'm trying to use Collections and the method synchronizedList. I have
something like this:

private List<UserBean> myList = Collections.synchronizedList(new
ArrayList<UserBean>()), where UserBean is a java-bean used in my
application.

When i try to compile this, i get the next error:

The method synchronizedList(List<UserBean>) is undefined for the type
Collections.

May i have to configure or, maybe, inherit something in my GWT
application.

Kind Regards,

Javier

Alfredo Quiroga-Villamil

unread,
Dec 27, 2011, 10:01:05 AM12/27/11
to google-we...@googlegroups.com

If the code you have posted is meant to run in the client, the synchronized if I am not mistaken does not apply. There are no threads there.

Regards,

Alfredo

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Jens

unread,
Dec 27, 2011, 10:13:30 AM12/27/11
to google-we...@googlegroups.com
Collections.synchronizedList() is not emulated by GWT (see: http://code.google.com/intl/de-DE/webtoolkit/doc/latest/RefJreEmulation.html)

Your client code runs in a single thread in the browser so there is no need for synchronizedList.

-- J.
Reply all
Reply to author
Forward
0 new messages