summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/immutable/Iterable.scala
Commit message (Collapse)AuthorAgeFilesLines
* SI-7577 Incorrect documentation: current default isn't VectorRex Kerr2014-06-261-0/+1
| | | | Fixed documentation to specify List in four cases where it was wrong or missing.
* Absolutized paths involving the scala package.Paul Phillips2013-05-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Confusing, now-it-happens now-it-doesn't mysteries lurk in the darkness. When scala packages are declared like this: package scala.collection.mutable Then paths relative to scala can easily be broken via the unlucky presence of an empty (or nonempty) directory. Example: // a.scala package scala.foo class Bar { new util.Random } % scalac ./a.scala % mkdir util % scalac ./a.scala ./a.scala:4: error: type Random is not a member of package util new util.Random ^ one error found There are two ways to play defense against this: - don't use relative paths; okay sometimes, less so others - don't "opt out" of the scala package This commit mostly pursues the latter, with occasional doses of the former. I created a scratch directory containing these empty directories: actors annotation ant api asm beans cmd collection compat concurrent control convert docutil dtd duration event factory forkjoin generic hashing immutable impl include internal io logging macros man1 matching math meta model mutable nsc parallel parsing partest persistent process pull ref reflect reify remote runtime scalap scheduler script swing sys text threadpool tools transform unchecked util xml I stopped when I could compile the main src directories even with all those empties on my classpath.
* Brings all copyrights (in comments) up-to-date, from 2011/12 to 2013Heather Miller2012-11-021-1/+1
|
* Fixes SI-4478.Simon Ochsenreither2012-05-021-2/+2
| | | | | | | | | | - Replaced/simplified usages of "wrt". - Added backticks to $Coll definitions, so stuff like "immutable.Stack" hopefully stops being interpreted as the end of a sentence and shown like that in the summary line of ScalaDoc's method description. See collection.immutable.Stack's sortBy. Additionally, it looks nicer this way. - Fixes the typo mentioned in SI-5666.
* Discovered another impressive source of unneces...Paul Phillips2011-07-041-1/+1
| | | | | | | | | | Discovered another impressive source of unnecessary garbage is every collection creating a new GenericCanBuildFrom for every map ever performed. They can all use the same one: they all have the same implementation. It looks like tiark had already figured this out and done it for Vector: I followed with the other fifty. I really haven't the least idea who to have review most things. No review.
* Removed GenTravOnceLike and TravOnceLike, put t...Aleksandar Pokopec2011-04-191-1/+1
| | | | | | | | | Removed GenTravOnceLike and TravOnceLike, put their functionality to GenTravOnce and TravOnce. Remove immutable Gen* traits. Removing mutable Gen* traits. No review.
* Refactoring the collections api to support diff...Aleksandar Pokopec2011-04-131-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactoring the collections api to support differentiation between referring to a sequential collection and a parallel collection, and to support referring to both types of collections. New set of traits Gen* are now superclasses of both their * and Par* subclasses. For example, GenIterable is a superclass of both Iterable and ParIterable. Iterable and ParIterable are not in a subclassing relation. The new class hierarchy is illustrated below (simplified, not all relations and classes are shown): TraversableOnce --> GenTraversableOnce ^ ^ | | Traversable --> GenTraversable ^ ^ | | Iterable --> GenIterable <-- ParIterable ^ ^ ^ | | | Seq --> GenSeq <-- ParSeq (the *Like, *View and *ViewLike traits have a similar hierarchy) General views extract common view functionality from parallel and sequential collections. This design also allows for more flexible extensions to the collections framework. It also allows slowly factoring out common functionality up into Gen* traits. From now on, it is possible to write this: import collection._ val p = parallel.ParSeq(1, 2, 3) val g: GenSeq[Int] = p // meaning a General Sequence val s = g.seq // type of s is Seq[Int] for (elem <- g) { // do something without guarantees on sequentiality of foreach // this foreach may be executed in parallel } for (elem <- s) { // do something with a guarantee that foreach is executed in order, sequentially } for (elem <- p) { // do something concurrently, in parallel } This also means that some signatures had to be changed. For example, method `flatMap` now takes `A => GenTraversableOnce[B]`, and `zip` takes a `GenIterable[B]`. Also, there are mutable & immutable Gen* trait variants. They have generic companion functionality.
* Removing toPar* methods, since we've agreed the...Aleksandar Pokopec2011-03-181-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removing toPar* methods, since we've agreed they're difficult to: - underestand - maintain Also, changed the docs and some tests appropriately. Description: 1) Every collection is now parallelizable - switch to the parallel version of the collection is done via `par`. - Traversable collections and iterators have `par` return a parallel - collection of type `ParIterable[A]` with the implementation being the - representative of `ParIterable`s (currently, `ParArray`). Iterable - collections do the same thing. Sequences refine `par`'s returns type - to `ParSeq[A]`. Maps and sets do a similar thing. The above means that the contract for `par` changed - it is no longer guaranteed to be O(1), nor reflect the same underlying data, as was the case for mutable collections before. Method `par` is now at worst linear. Furthermore, specific collection implementations override `par` to a more efficient alternative - instead of copying the dataset, the dataset is shared between the old and the new version. Implementation complexity may be sublinear or constant in these cases, and the underlying data structure may be shared. Currently, these data structures include parallel arrays, maps and sets, vectors, hash trie maps and sets, and ranges. Finally, parallel collections implement `par` trivially. 2) Methods `toMap`, `toSet`, `toSeq` and `toIterable` have been refined for parallel collections to switch between collection types, however, they never switch an implementation from parallel to sequential. They may or may not copy the elements, as is the case with sequential variants of these methods. 3) The preferred way to switch between different collection types, whether maps, sets and seqs, or parallel and sequential, is now via use of methods `toIterable`, `toSeq`, `toSet` and `toMap` in combination with `par` and `seq`. Review by odersky.
* Updated copyright notices to 2011Antonio Cunei2011-01-201-1/+1
|
* Removed more than 3400 svn '$Id' keywords and r...Antonio Cunei2010-05-121-1/+0
| | | | | Removed more than 3400 svn '$Id' keywords and related junk.
* docs for immutable.A-L*. no reviewAleksandar Pokopec2010-04-131-6/+6
|
* Updated documentationMartin Odersky2010-04-091-7/+2
|
* Updated copyright notices to 2010Antonio Cunei2009-12-071-1/+1
|
* removed some of the code duplication that Marti...Adriaan Moors2009-10-221-4/+1
| | | | | removed some of the code duplication that Martin pointed out in my addition of def apply() to GenericCanBuildFrom
* renamed BuilderFactory[El, To, From] -> CanBuil...Adriaan Moors2009-10-211-1/+4
| | | | | | | | | | | | | | | | | | | | | renamed BuilderFactory[El, To, From] -> CanBuildFrom[From, El, To] and added apply() overload to create collections from scratch generically added def apply() overload to BuilderFactory so that we can also create collections from scratch generically (see test test/files/pos/collectGenericCC.scala) renaming: - BuilderFactory[El, To, From] -> CanBuildFrom[From, El, To] bulk type-param reordering using: s/CanBuildFrom\[\s*([^,()\s]*)\s*,(\s+[^\s,()]*)\s*,\s+([^\s,()]*)\s*\]/CanBuildFrom[$3, $1,$2]/ some argument lists got mixed up because they contained 4 comma's... - builderFactory -> canBuildFrom removed explicit implicit value in DocDriver that was renamed renamed collection/generic/BuilderFactory.scala -> collection/generic/CanBuildFrom.scala tested with clean build using ant strap.done -- everything went well on my machine
* add @since annotationsstepancheg2009-09-261-0/+2
|
* Collections refactoring.Martin Odersky2009-09-251-8/+9
|
* fixed headers/comments/svn props, made some pro...michelou2009-09-151-1/+16
| | | | | | fixed headers/comments/svn props, made some progress with serializable classes
* switch to unnested packages.Martin Odersky2009-07-241-1/+2
|
* more collection cleanups and better docsMartin Odersky2009-05-141-1/+1
|
* cleaned up collection builder frameworkMartin Odersky2009-05-141-5/+6
|
* Removed redundant type parameter for class Buil...Martin Odersky2009-05-091-2/+2
| | | | | Removed redundant type parameter for class Builder
* make all scala source files not executablestepancheg2009-05-081-0/+0
|
* 4 out of 5 spelling bee champs say: TraversablePaul Phillips2009-05-081-4/+4
|
* massive new collections checkin.Martin Odersky2009-05-081-0/+23