- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
2.8.0 converting from Java List to Scala List
Hi Guys.
In my continued update from 2.7.5 to 2.8.0, I am now addressing the issue of
converting from Java Lists to Scala Lists to be able to enjoy the added
niceness (foreach, filter etc etc) of Scala Lists. I used to use something
along the lines of :
def toList[T](list: java.util.List[T]) = new BufferWrapper[T] { def
underlying = list }
for lists, and :
def toMap[K, E](m: java.util.Map[K, E]) = new MapWrapper[K, E] { def
underlying = m }
for maps, using scala.collection.jcl.BufferWrapper, and
scala.collection.jcl.MapWrapper.
How do I do this in 2.8.0? Can anyone point me to the docs?
Thanks in advance for your help,
regards










Re: 2.8.0 converting from Java List to Scala List
Just import scala.collection.JavaConversions._ then simply use any scala method you wish on a java list and enjoy the results.
On Wed, Aug 12, 2009 at 11:23 AM, rossputin <rossajmcd [at] yahoo [dot] co [dot] uk> wrote:
Re: 2.8.0 converting from Java List to Scala List
Hi Kevin.
Thats great, thanks!