...
| Objective-C | Java | Scala | ||
---|---|---|---|---|---|
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="a83e0b049b6037d2-3b0ccef3-4ac64882-a908879b-e9b2ae6b7f78b74ccbcf3a40"><ac:plain-text-body><![CDATA[ | getter | | | | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="e7d3ddf4a82432fb-db65bdc3-42c24c4c-b6fd85d2-de6dde5a2b6cc0cd53b81c7e"><ac:plain-text-body><![CDATA[ | setter | | | | ]]></ac:plain-text-body></ac:structured-macro> |
...
To use the Scala Collections API with an NSArray or NSDictionary you simply need to add an import:
Code Block | ||||
---|---|---|---|---|
| ||||
import scala.collection.JavaConversions._ |
Then After that, you can may access the typical Scala collection methods directly on NSArray. This employs a feature of Scala known as implicit conversions to automagically cast a NSArray (a Java Iterable) into a Scala Iterable while leaving the actual object unchanged. Alternatively, you could generate an actual new scala.List instance by calling myNSArray.toList.
...