Java Mailing List Archive

http://www.gg3721.com/

Home » user.groovy »

[groovy-user] Lists and Ranges

Omar Abou Mrad

2010-09-01

Replies: Find Java Web Hosting

Author LoginPost Reply
Hello,

As per the documentation: Ranges allow you to create a list of sequential values. These can be used as Lists since Range extends java.util.List.

Yet the following

def a = 1..5
Collections.shuffle(a)

yields java.lang.UnsupportedOperationException

whereas

def b = [1,2,3,4,5]
Collections.shuffle(b)

Works quite fine.

Am i missing something?

Regards,

Omar
©2008 gg3721.com - Jax Systems, LLC, U.S.A.