summaryrefslogtreecommitdiff
path: root/src/library/scala/collection/TraversableOnce.scala
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/2.11.x' into ↵Jason Zaugg2016-02-251-4/+5
|\ | | | | | | | | | | | | | | | | | | | | merge/2.11.x-to-2.12.x-20160225 Conflicts: scripts/jobs/integrate/bootstrap src/build/maven/scala-actors-pom.xml test/files/pos/t3420.flags Conflicts were trivial to resolve.
| * SI-9624 Improve documentation for TraversableOnceStefan Zeiger2016-02-041-4/+5
| | | | | | | | | | | | | | | | | | - Move the doc comment for `hasDefiniteSize` up from TraversableLike to GenTraversableOnce and improve it. - Add a note to `GenTraversableOnce.isEmpty` that implementations must not consume elements. - Clarify alternatives to subclassing TraversableOnce.
* | Remove unused imports and other minor cleanupsSimon Ochsenreither2015-12-181-1/+1
|/ | | | | | | | | | - Language imports are preceding other imports - Deleted empty file: InlineErasure - Removed some unused private[parallel] methods in scala/collection/parallel/package.scala This removes hundreds of warnings when compiling with "-Xlint -Ywarn-dead-code -Ywarn-unused -Ywarn-unused-import".
* Conform foreach tparam to majority naming conventionvsalvis2015-10-211-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'U' is the common choice for the foreach function result tparam. This command summarises the naming diversity before and after this change. $ fgrep -r 'def foreach[' *|cut -f2 -d:|cut -f1 -d'('|tr -s ' '|sed 's/override //g'|sort|uniq -c|sort -nr Before, 80 def foreach[U] 6 def foreach[C] 6 def foreach[B] 4 final def foreach[U] 3 def foreach[S] 2 inline final def foreach[U] 2 def foreach[A] 1 inline final def foreach[specialized 1 final def foreach[B] 1 * def foreach[U] 1 def foreach[Q] 1 def foreach[D] 1 def foreach[A,B,U] After, 98 def foreach[U] 5 final def foreach[U] 2 inline final def foreach[U] 1 inline final def foreach[specialized 1 * def foreach[U] 1 def foreach[A,B,U] (@ symbols removed.)
* Performance improvement: collectFirst in TraversableOnceRex Kerr2015-03-301-2/+15
| | | | | | | | | | | collectFirst was implemented in TraversableOnce by calling toIterator and then using a non-local return to pull out a Some when the partial function succeeded. This had two problems: 1. If the TraversableOnce was Iterator or Iterable, stepping through until pf is happy is much (15x!) faster. 2. If the TraversableOnce was not, creating an Iterator is a waste of time and memory This fixes both of these issues by inspecting the self-type and choosing the appropriate implementation. Further (modest) improvements likely possible in 2.12 by moving specialized implementations to child classes and using `applyOrElse` on the partial function with a package-private object instead of a locally created one.
* cleanup @throws tags in library and reflectAntoine Gourlay2014-11-051-1/+1
| | | | | - there is no need for explicit links with [[ and ]] - there is no need for explicit backquoting
* [backport] Fixes cut sentences in the generated scaladocsDominik Gruntz2014-08-111-1/+1
| | | | | | | | | | | | | | | | | This commit changes all first sentences of library functions which contain `i.e.` or `e.g.` and adds a `,` to prevent that the scaladoc summary sentence is cut after this abbreviation. This is possible as pull/3824 fixed how Scaladoc parses the first sentence of a method description into a sumary sentence(now the first sentence has to end with a dot followed by whitespace). Only docs in the core library are changed (src/library/**/*.scala) and only if they occur in the first sentence. Review by @heathermiller (cherry picked from commit 72721ff5dd06dea1235ecb71acae0bd61aee4814)
* SI-8587 Explicitly document forall/exists for empty collectionsJason Zaugg2014-05-141-4/+3
| | | | | | This behaviour isn't always intuitive for newcomers. Also changes inadvertant doc comment to an impl. comment.
* Fixes #3330 with Scaladoc changes onlyJason Swartz2014-01-071-14/+14
|
* Collections: remove redundant calls to .seqJason Zaugg2013-10-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Students of Scala's history might recall that at introduction of parallel collections, GenIterable et al were *not* added; instead the parallel collections inherited from the existing interfaces. This of course was an invitation to widespread disaster as any existing code that foreach-ed over a collection might now experience unwanted concurrency. The first attempt to fix this was to add the `.seq` method to convert a parallel colleciton to a sequential one. This was added in e579152f732, and call sites in the standard library with side-effecting foreach calls were changed to use that. But this was (rightly) deemed inadequate, as we could hardly expect people to change existing code or remember to do this in new code. So later, in 3de96153e5b, GenIterable was sprouted, and parallel collections were re-parented. This commit removes residual needless calls to .seq when the static type of the receiver is already a plain Iterable, which are no-ops.
* Cull extraneous whitespace.Paul Phillips2013-09-181-1/+1
| | | | | | | | | | | | | | | | | | | | | One last flurry with the broom before I leave you slobs to code in your own filth. Eliminated all the trailing whitespace I could manage, with special prejudice reserved for the test cases which depended on the preservation of trailing whitespace. Was reminded I cannot figure out how to eliminate the trailing space on the "scala> " prompt in repl transcripts. At least reduced the number of such empty prompts by trimming transcript code on the way in. Routed ConsoleReporter's "printMessage" through a trailing whitespace stripping method which might help futureproof against the future of whitespace diseases. Deleted the up-to-40 lines of trailing whitespace found in various library files. It seems like only yesterday we performed whitespace surgery on the whole repo. Clearly it doesn't stick very well. I suggest it would work better to enforce a few requirements on the way in.
* SI-7614 Minimize the times of evaluation f in TraversableOnce.maxBy/minBy.yllan2013-07-061-2/+26
| | | | | | | | | | | | | In the previous implementation, maxBy/minBy will evaluate most of its elements with f twice to get the ordering. That results (2n - 2) evaluations of f. I save both the element and result of evaluation to a tuple so that it doesn't need to re-evaluate f on next comparison. Thus only n evaluations of f, that is the optimal. Note that the original implementation always returns the first matched if more than one element evaluated to same largest/smallest value of f. I document this behavior explicitly in this commit as well.
* 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.
* Renamed type param to be consistent with convention.Paul Phillips2013-03-031-5/+5
| | | | | | | It's super confusing to see debugging output showing a type constructor called "Coll". The convention in the collections is that CC[A] takes type parameters and Coll is an alias for the applied type.
* More explicit empty paren lists in method calls.Jason Zaugg2013-02-241-3/+3
|
* Merge pull request #1921 from soc/SI-6811-removalsPaul Phillips2013-01-241-5/+0
|\ | | | | SI-6811 Scheduled removal of deprecated items for 2.11
| * SI-6811 Remove deprecated elements in scala.collectionSimon Ochsenreither2013-01-171-5/+0
| |
* | Merge branch '2.10.x'Adriaan Moors2013-01-161-0/+14
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/doc/Settings.scala src/compiler/scala/tools/nsc/interpreter/CompletionOutput.scala src/compiler/scala/tools/nsc/matching/Patterns.scala src/compiler/scala/tools/nsc/transform/UnCurry.scala src/compiler/scala/tools/nsc/typechecker/Infer.scala src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala src/reflect/scala/reflect/internal/settings/MutableSettings.scala src/reflect/scala/reflect/runtime/Settings.scala src/swing/scala/swing/SwingActor.scala src/swing/scala/swing/SwingWorker.scala test/files/run/t6955.scala
| * SI-6930 adds documentation to reduceLeft in TraversableOnceHeather Miller2013-01-081-0/+14
| |
* | Merge pull request #1570 from retronym/ticket/6448Adriaan Moors2012-11-211-4/+2
|\ \ | | | | | | SI-6448 Collecting the spoils of PartialFun#runWith
| * | SI-6448 Collecting the spoils of PartialFun#runWithJason Zaugg2012-11-041-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoids calling both `isDefinedAt` and `apply`. This pathological case that would benefit the most looks like: xs collect { case x if {expensive(); true} => x } The typical change looks like: - for (x <- this) if (pf.isDefinedAt(x)) b += pf(x) + foreach(pf.runWith(b += _)) Incorporates feedback provided by Pavel Pavlov: https://github.com/retronym/scala/commit/ef5430 A few more opportunities for optimization are noted in the `Pending` section of the enclosed test. `Iterator.collect` would be nice, but a solution eludes me. Calling the guard less frequently does change the behaviour of these functions in an obervable way, but not contravene the documented semantics. That said, there is an alternative opinion on the comment of the ticket: https://issues.scala-lang.org/browse/SI-6448
* | | Merge commit 'refs/pull/1574/head' into merge-210Paul Phillips2012-11-051-1/+1
|\ \ \ | |/ / |/| / | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'refs/pull/1574/head': (24 commits) Fixing issue where OSGi bundles weren't getting used for distribution. Fixes example in Type.asSeenFrom Fix for SI-6600, regression with ScalaNumber. SI-6562 Fix crash with class nested in @inline method Brings copyrights in Scaladoc footer and manpage up-to-date, from 2011/12 to 2013 Brings all copyrights (in comments) up-to-date, from 2011/12 to 2013 SI-6606 Drops new icons in, replaces abstract types placeholder icons SI-6132 Revisited, cleaned-up, links fixed, spelling errors fixed, rewordings Labeling scala.reflect and scala.reflect.macros experimental in the API docs Typo-fix in scala.concurrent.Future, thanks to @pavelpavlov Remove implementation details from Position (they are still under reflection.internal). It probably needs more cleanup of the api wrt to ranges etc but let's leave it for later SI-6399 Adds API docs for Any and AnyVal Removing actors-migration from main repository so it can live on elsewhere. Fix for SI-6597, implicit case class crasher. SI-6578 Harden against synthetics being added more than once. SI-6556 no assert for surprising ctor result type Removing actors-migration from main repository so it can live on elsewhere. Fixes SI-6500 by making erasure more regular. Modification to SI-6534 patch. Fixes SI-6559 - StringContext not using passed in escape function. ... Conflicts: src/actors-migration/scala/actors/migration/StashingActor.scala src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala src/compiler/scala/tools/nsc/settings/AestheticSettings.scala src/compiler/scala/tools/nsc/transform/Erasure.scala src/library/scala/Application.scala src/library/scala/collection/immutable/GenIterable.scala.disabled src/library/scala/collection/immutable/GenMap.scala.disabled src/library/scala/collection/immutable/GenSeq.scala.disabled src/library/scala/collection/immutable/GenSet.scala.disabled src/library/scala/collection/immutable/GenTraversable.scala.disabled src/library/scala/collection/mutable/GenIterable.scala.disabled src/library/scala/collection/mutable/GenMap.scala.disabled src/library/scala/collection/mutable/GenSeq.scala.disabled src/library/scala/collection/mutable/GenSet.scala.disabled src/library/scala/collection/mutable/GenTraversable.scala.disabled src/library/scala/collection/parallel/immutable/ParNumericRange.scala.disabled
| * Brings all copyrights (in comments) up-to-date, from 2011/12 to 2013Heather Miller2012-11-021-1/+1
| |
* | SI-6467: Zero element in aggregate now by-nameAleksandar Prokopec2012-10-041-1/+1
|/
* SI-6449 Adds version arg to @deprecated usages (non-compiler sources)Simon Ochsenreither2012-09-291-2/+2
|
* Eliminate breaking relative names in source.Paul Phillips2012-09-141-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These things are killing me. Constructions like package scala.foo.bar.baz import foo.Other DO NOT WORK in general. Such files are not really in the "scala" package, because it is not declared package scala package foo.bar.baz And there is a second problem: using a relative path name means compilation will fail in the presence of a directory of the same name, e.g. % mkdir reflect % scalac src/reflect/scala/reflect/internal/util/Position.scala src/reflect/scala/reflect/internal/util/Position.scala:9: error: object ClassTag is not a member of package reflect import reflect.ClassTag ^ src/reflect/scala/reflect/internal/util/Position.scala:10: error: object base is not a member of package reflect import reflect.base.Attachments ^ As a rule, do not use relative package paths unless you have explicitly imported the path to which you think you are relative. Better yet, don't use them at all. Unfortunately they mostly work because scala variously thinks everything scala.* is in the scala package and/or because you usually aren't bootstrapping and it falls through to an existing version of the class already on the classpath. Making the paths explicit is not a complete solution - in particular, we remain enormously vulnerable to any directory or package called "scala" which isn't ours - but it greatly limts the severity of the problem.
* Renaming convertTo to to on GenTraversableOnce.Josh Suereth2012-06-281-6/+6
|
* Migrate build to @odersky's suggestion of convertTo.Josh Suereth2012-06-181-4/+13
| | | | | | * Move method into TraversableOnce from Iterator and Traversable to make the build pass. * Udpate IDE tests with new collection methods. * Rewire default toXYZ methods to use convertTo.
* removes array tagsEugene Burmako2012-06-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before 2.10 we had a notion of ClassManifest that could be used to retain erasures of abstract types (type parameters, abstract type members) for being used at runtime. With the advent of ClassManifest (and its subtype Manifest) it became possible to write: def mkGenericArray[T: Manifest] = Array[T]() When compiling array instantiation, scalac would use a ClassManifest implicit parameter from scope (in this case, provided by a context bound) to remember Ts that have been passed to invoke mkGenericArray and use that information to instantiate arrays at runtime (via Java reflection). When redesigning manifests into what is now known as type tags, we decided to explore a notion of ArrayTags that would stand for abstract and pure array creators. Sure, ClassManifests were perfectly fine for this job, but they did too much - technically speaking, one doesn't necessarily need a java.lang.Class to create an array. Depending on a platform, e.g. within JavaScript runtime, one would want to use a different mechanism. As tempting as this idea was, it has also proven to be problematic. First, it created an extra abstraction inside the compiler. Along with class tags and type tags, we had a third flavor of tags - array tags. This has threaded the additional complexity though implicits and typers. Second, consequently, when redesigning tags multiple times over the course of Scala 2.10.0 development, we had to carry this extra abstraction with us, which exacerbated the overall feeling towards array tags. Finally, array tags didn't fit into the naming scheme we had for tags. Both class tags and type tags sound logical, because, they are descriptors for the things they are supposed to tag, according to their names. However array tags are the odd ones, because they don't actually tag any arrays. As funny as it might sound, the naming problem was the last straw that made us do away with the array tags. Hence this commit.
* removes tags and their incantations from PredefEugene Burmako2012-06-081-0/+1
| | | | | | All tags and reflection-related stuff requires a prefix, be it scala.reflect for simple tags (ArrayTags and ClassTags), or scala.reflect.basis/scala.reflect.runtime.universe for type tags.
* Address doc comment rot in the standard library.Jason Zaugg2012-05-131-2/+0
| | | | | | | | | | | | | | | | | | | | | - Match @param/@tparam names to the actual parameter name - Use @tparam for type parameters - Whitespace is required between `*` and `@` - Fix incorrect references to @define macros. - Use of monospace `` and {{{}}} (much more needed) - Remove `@param p1 ...` stubs, which appear in the generated docss. - But, retainsed `@param p1` stubs, assuming they will be filtered from the generated docs by SI-5795. - Avoid use of the shorthand `@param doc for the solitary param` (which works, but isn't recognized by the code inspection in IntelliJ I used to sweep through the problems) The remaining warnings from `ant docs` seem spurious, I suspect they are an unintended consequence of documenting extension methods. [scaladoc] /Users/jason/code/scala/src/library/scala/collection/TraversableOnce.scala:181: warning: Variable coll undefined in comment for method reduceOption in class Tuple2Zipped [scaladoc] def reduceOption[A1 >: A](op: (A1, A1) => A1): Option[A1] = reduceLeftOption(op) [scaladoc] ^
* Workaround for scaladoc failure.Paul Phillips2012-05-011-1/+1
| | | | | | | | | | Addressing this little fellow: 21:40:22 [scaladoc] src/library/scala/collection/TraversableOnce.scala:382: error: missing parameter type for expanded function 21:40:22 [scaladoc] The argument types of an anonymous function must be fully known. (SLS 8.5) 21:40:22 [scaladoc] Expected type was: _[?] => Coll[A] 21:40:22 [scaladoc] case xs: generic.GenericTraversableTemplate[_, _] => xs.genericBuilder mapResult { 21:40:22 [scaladoc] ^
* Refactor OnceCanBuildFrom to check the collection type.Aleksandar Prokopec2012-05-011-5/+14
| | | | | | | | | | | | | | | | | | | | | | The builder is now instantiated as an iterator builder only if a generic builder cannot be found on the collection that requested the builder. Reason - we want this behaviour: scala> scala.util.Random.shuffle(List(1, 2, 3): collection.TraversableOnce[Int]) res0: scala.collection.TraversableOnce[Int] = List(3, 1, 2) instead of this one: scala> scala.util.Random.shuffle(List(1, 2, 3): collection.TraversableOnce[Int]) res0: scala.collection.TraversableOnce[Int] = non-empty iterator which may lead to nasty surprises. Alternately, to avoid pattern-matching in OnceCanBuildFrom.apply, we could mix in GenericTraversableTemplate-related functionaly into TraversableOnce, but this may become too complicated.
* Widen types in signatures of Future companion methods, refactor ↵Aleksandar Prokopec2012-05-011-11/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | OnceCanBuildFrom. Removed the implicit modifier on the OnceCanBuildFrom, as we don't support implicit classes with zero arguments. Added an implicit OnceCanBuildFrom method. The idea behind OnceCanBuildFrom is for it to be used by methods which construct collections, but are defined outside of collection classes. OnceCanBuildFrom so far worked only for objects of type TraversableOnce: shuffle(List(1, 2, 3).iterator: TraversableOnce[Int]) but this used to result in an implicit resolution error: shuffle(List(1, 2, 3).iterator) because after the type parameter M for `shuffle` was inferred to Iterator, no implicit of type CanBuildFrom[Iterator[_], A, Iterator[A]] could be found. Introduced another CanBuildFrom to the Iterator companion object. Modified Future tests appropriately.
* migrates stdlib and compiler to tagsEugene Burmako2012-04-231-1/+1
| | | | | * all usages of ClassManifest and Manifest are replaced with tags * all manifest tests are replaced with tag tests
* Enabling postfix ops feature warning, and working on libs to avoid them.Martin Odersky2012-04-121-1/+1
|
* Various improvements to SIP 18 diagnostics. Made scala library and compiler ↵Martin Odersky2012-04-121-4/+8
| | | | feature clean.
* A first bunch of Any-extending traits.Martin Odersky2012-02-061-1/+4
|
* Fixing redundant type parameter in toIndexedSeq which causes suboptimal type ↵Martin Odersky2012-01-101-1/+1
| | | | inference
* Dropped about 1.5 Mb off scala-library.jar.Paul Phillips2011-11-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit and the two subsequent commits were contributed by: Todd Vierling <tv@duh.org>. I combined some commits and mangled his commit messages, but all the credit is his. This pursues the same approach to classfile reduction seen in r19989 when AbstractFunctionN was introduced, but applies it to the collections. Thanks to -Xlint it's easy to verify that the private types don't escape. Design considerations as articulated by Todd: * Don't necessarily create concrete types for _everything_. Where a subtrait only provides a few additional methods, don't bother; instead, use the supertrait's concrete class and retain the "with". For example, "extends AbstractSeq[A] with LinearSeq[A]". * Examine all classes with .class file size greater than 10k. Named classes and class names ending in $$anon$<num> are candidates for analysis. * If a return type is currently inferred where an anon subclass would be returned, make the return type explicit. Don't allow the library-private abstract classes to leak into the public namespace [and scaladoc].
* - Update Scaladoc for LinkedList and for some o...Paul Phillips2011-07-291-0/+39
| | | | | | | | | | - Update Scaladoc for LinkedList and for some of the functions/operators - that it inherits. Completed Scaladoc for append Added example - in GenSeqLike for apply. Added $collectExample to collect in - GenTraversableLike and supplied an actual example in LinkedList Contributed by Donald McLean.
* Fixes #4490 and #4467.Kato Kazuyoshi2011-06-181-9/+7
|
* Fix for Iterator flattening regression.Paul Phillips2011-05-141-1/+6
| | | | | | | | | | but my theory is that ++ takes a by name argument, but doing a foldLeft and using ++ to join creates a closure which loses the by-nameness. If this theory is correct that's an ugly trap. Not sure how I write a test against this sort of thing? Will take pointers. For now, closes #4582, no review.
* Removed GenTravOnceLike and TravOnceLike, put t...Aleksandar Pokopec2011-04-191-6/+276
| | | | | | | | | 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-571/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Addressing most of the warnings revealed by the...Paul Phillips2011-03-301-0/+6
| | | | | | Addressing most of the warnings revealed by the patch to warn about unknown scaladoc variables. Updated and reran genprod. No review.
* Added some implicitNotFound annotations to comm...Paul Phillips2011-03-281-1/+1
| | | | | | | Added some implicitNotFound annotations to commonly used classes, and some documentation to Manifest. (Said documentation is invisible for the moment due to #4404.) No review.
* Implementing foreach to work in parallel in Par...Aleksandar Pokopec2011-03-221-3/+3
| | | | | | | | | | | | Implementing foreach to work in parallel in ParIterableLike. Doing a bunch of refactoring around in the collection framework to ensure a parallel foreach is never called with a side-effecting method. This still leaves other parts of the standard library and the compiler unguarded. No review.
* Adding the `seq` method to all collections.Aleksandar Pokopec2011-03-221-0/+16
|
* Removing toPar* methods, since we've agreed the...Aleksandar Pokopec2011-03-181-60/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.