- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Turning an array into a list
Is there any built-in way to produce a list from an array? Or does one
have to construct the list element by element, generating many
intermediate lists that will be thrown out.
Thanks,
Ken










Re: Turning an array into a list
On Sun, Jan 11, 2009 at 03:09:30PM -0600, Kenneth McDonald wrote:
> Is there any built-in way to produce a list from an array? Or does one
> have to construct the list element by element, generating many
> intermediate lists that will be thrown out.
Hi,
Just to clarify :
when you use a list to create another one (with a new head),
nothing is thrown out ! The first list IS the tail.
>
> Thanks,
> Ken
Re: Turning an array into a list
Array(1,2,3).toList
? ;-)
On Sun, Jan 11, 2009 at 1:09 PM, Kenneth McDonald <kenneth [dot] m [dot] mcdonald [at] sbcglobal [dot] net> wrote:
--
Lift, the simply functional web framework http://liftweb.net
Collaborative Task Management http://much4.us
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp
Re: Turning an array into a list
Arrays.asList( scalaArray : _* )
Note: I believe you have to import java.util.Arrays or something like that.
-Josh
On Sun, Jan 11, 2009 at 4:11 PM, David Pollak <feeder [dot] of [dot] the [dot] bears [at] gmail [dot] com> wrote: