Get item in the list in Scala? - Stack Overflow
Use parentheses:
data(2) But you don't really want to do that with lists very often, since linked lists take time to traverse. If you want to index into a collection, use Vector (immutable) or ArrayBuffer (mutable) or possibly Array (which is just a Java array, except again you index into it with (i) instead of [i]).
Read full article from Get item in the list in Scala? - Stack Overflow
No comments:
Post a Comment