Skip to content

Commit d0542ef

Browse files
Restore BreaoutSrc
probably lost durring a rebase
1 parent a4f7b08 commit d0542ef

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
rule = "scala:fix.NewCollections"
3+
*/
4+
package fix
5+
6+
import scala.collection.breakOut
7+
8+
object BreakoutSrc {
9+
val xs = List(1, 2, 3)
10+
11+
xs.collect{ case x => x }(breakOut): Set[Int]
12+
xs.flatMap(x => List(x))(breakOut): collection.SortedSet[Int]
13+
xs.map(_ + 1)(breakOut): Set[Int]
14+
xs.reverseMap(_ + 1)(breakOut): Set[Int]
15+
xs.scanLeft(0)((a, b) => a + b)(breakOut): Set[Int]
16+
xs.union(xs)(breakOut): Set[Int]
17+
xs.updated(0, 1)(breakOut): Set[Int]
18+
xs.zip(xs)(breakOut): Map[Int, Int]
19+
xs.zipAll(xs, 0, 0)(breakOut): Array[(Int, Int)]
20+
21+
(xs ++ xs)(breakOut): Set[Int]
22+
(1 +: xs)(breakOut): Set[Int]
23+
(xs :+ 1)(breakOut): Set[Int]
24+
(xs ++: xs)(breakOut): Set[Int]
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
3+
4+
package fix
5+
6+
7+
object BreakoutSrc {
8+
val xs = List(1, 2, 3)
9+
10+
xs.iterator.collect{ case x => x }.to(implicitly): Set[Int]
11+
xs.iterator.flatMap(x => List(x)).to(implicitly): collection.SortedSet[Int]
12+
xs.iterator.map(_ + 1).to(implicitly): Set[Int]
13+
xs.reverseIterator.map(_ + 1).to(implicitly): Set[Int]
14+
xs.iterator.scanLeft(0)((a, b) => a + b).to(implicitly): Set[Int]
15+
xs.iterator.concat(xs).to(implicitly): Set[Int]
16+
xs.view.updated(0, 1).to(implicitly): Set[Int]
17+
xs.iterator.zip(xs).to(implicitly): Map[Int, Int]
18+
xs.iterator.zipAll(xs, 0, 0).to(implicitly): Array[(Int, Int)]
19+
20+
(xs.iterator ++ xs).to(implicitly): Set[Int]
21+
(1 +: xs.view).to(implicitly): Set[Int]
22+
(xs.view :+ 1).to(implicitly): Set[Int]
23+
(xs ++: xs.view).to(implicitly): Set[Int]
24+
}

0 commit comments

Comments
 (0)