Dave's Brain

Browse - Programming Tips - Scala has many collection classes and it can also use the Java collections.

Date: 2013aug27
Language: Scala

Q.  Scala has many collection classes and it can also use the Java collections.
What should I use?

A.  MUTABLE

Use mutable.ArrayList when you want something with order than can change.
Use mutable.Set when you want a set you can change.
Use mutable.HashMap when you want a hash you can change.
These require:

import collection.mutable
You can convert a Java ArrayList into a Scala mutable.ArrayList with asScalaBuffer() IMMUTABLE I don't have preferences for immutable connections yet.

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.