summaryrefslogtreecommitdiff
path: root/src/library/scala/Tuple2.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-10-27 22:50:40 +0000
committerPaul Phillips <paulp@improving.org>2010-10-27 22:50:40 +0000
commit6e6435156afeea32a02e13ff7e6b66e54d7575c5 (patch)
treeb8814a48af7366f0d0f4a55ea5c8f391fd234a6b /src/library/scala/Tuple2.scala
parent683af5895e3dead6a6dac3c9939a7bcd2c7bad18 (diff)
downloadscala-6e6435156afeea32a02e13ff7e6b66e54d7575c5.tar.gz
scala-6e6435156afeea32a02e13ff7e6b66e54d7575c5.tar.bz2
scala-6e6435156afeea32a02e13ff7e6b66e54d7575c5.zip
Some issues with Tuple2/3.
foreach method in Tuple3, and both classes have what is now a redundant zip method which is also unfortunately completely strict in a not entirely fixable fashion. So "zip" is deprecated in favor of zipped. Closes #3526, but the code which closes that is primarily found in r23228. No review.
Diffstat (limited to 'src/library/scala/Tuple2.scala')
-rw-r--r--src/library/scala/Tuple2.scala17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/library/scala/Tuple2.scala b/src/library/scala/Tuple2.scala
index 1050fa26fa..50d584f3b8 100644
--- a/src/library/scala/Tuple2.scala
+++ b/src/library/scala/Tuple2.scala
@@ -6,7 +6,7 @@
** |/ **
\* */
-// generated by genprod on Sat Oct 16 11:19:09 PDT 2010 (with extra methods)
+// generated by genprod on Wed Oct 27 14:26:15 PDT 2010 (with extra methods)
package scala
@@ -27,22 +27,11 @@ case class Tuple2[@specialized(Int, Long, Double) +T1, @specialized(Int, Long, D
/** Swap the elements of the tuple */
def swap: Tuple2[T2,T1] = Tuple2(_2, _1)
+ @deprecated("Use `zipped` instead.")
def zip[Repr1, El1, El2, To](implicit w1: T1 => TLike[El1, Repr1],
w2: T2 => Iterable[El2],
cbf1: CBF[Repr1, (El1, El2), To]): To = {
- val coll1: TLike[El1, Repr1] = _1
- val coll2: Iterable[El2] = _2
- val b1 = cbf1(coll1.repr)
- val elems2 = coll2.iterator
-
- for (el1 <- coll1) {
- if (elems2.hasNext)
- b1 += ((el1, elems2.next))
- else
- return b1.result
- }
-
- b1.result
+ zipped map ((x, y) => ((x, y)))
}
/** Wraps a tuple in a `Zipped`, which supports 2-ary generalisations of map, flatMap, filter,...