If you don't care to mutate the list in any way, you can try this:
var myList = {"a", "b", "c", "d", "e", "f", "g"}
return myList.listIterator(4).toList()
which yields {"e", "f", "g"} as a new list.
Y
On Dec 9, 10:26 am, Carson Gross <
carsongr...@gmail.com> wrote:
> On List, the subList() method returns a "view" of the larger list, so
> modifications will percolate through to it:
>
>
http://download.oracle.com/javase/1.4.2/docs/api/java/util/List.html#...)
>
> var myList = {"a", "b", "c}
> myList.subList( 0, 2 ).clear()
> print( myList ) // prints ["c"]
>
> Cheers,
> Carson
>
> On Thu, Dec 9, 2010 at 6:47 AM, Brandon Gresham <
bran...@thegreshams.net>wrote:
>
>
>
>
>
>
>
> > You could use java's ArrayList...
>
> > ArrayList.removeRange( 0, N )
>
> > For arrays, you could massage to an ArrayList first...
>
> > var arrayList = Arrays.asList( myArray ) as ArrayList
>
> > -----Original Message-----
> > From:
gosu...@googlegroups.com [mailto:
gosu...@googlegroups.com] On
> > Behalf Of dw
> > Sent: Thursday, December 09, 2010 12:51 AM
> > To: gosu-lang
> > Subject: [gosu-lang:187] Truncate an array / list?
>
> > Silly question, but I'm wondering what the best way is to remove the
> > first N elements of an array or list. I didn't see anything obvious
> > in the docs.
>
> > Cheers,
>
> > David
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "gosu-lang" group.
> > To post to this group, send email to
gosu...@googlegroups.com.
> > To unsubscribe from this group, send email to
> >
gosu-lang+...@googlegroups.com<gosu-lang%2Bunsubscribe@googlegroups .com>
> > .
> >
gosu-lang+...@googlegroups.com<gosu-lang%2Bunsubscribe@googlegroups .com>
> > .