File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed
stream-tests/src/test/scala/org/apache/pekko/stream/impl
stream/src/main/scala/org/apache/pekko/stream/scaladsl Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -521,7 +521,7 @@ class TraversalBuilderSpec extends PekkoSpec {
521521 }
522522
523523 " find Source.iterable via TraversalBuilder with getValuePresentedSource" in {
524- val iterable = List (" a" )
524+ val iterable = List (" a" , " b " , " c " )
525525 TraversalBuilder .getValuePresentedSource(Source (iterable)).get.asInstanceOf [IterableSource [
526526 String ]].elements should === (
527527 iterable)
Original file line number Diff line number Diff line change @@ -402,13 +402,15 @@ object Source {
402402 * stream will see an individual flow of elements (always starting from the
403403 * beginning) regardless of when they subscribed.
404404 */
405- def apply [T ](iterable : immutable.Iterable [T ]): Source [T , NotUsed ] = {
406- (iterable.knownSize: @ switch) match {
407- case 0 => empty
408- case 1 => single(iterable.head)
409- case _ =>
410- fromGraph(new IterableSource [T ](iterable)).withAttributes(DefaultAttributes .iterableSource)
411- }
405+ def apply [T ](iterable : immutable.Iterable [T ]): Source [T , NotUsed ] = iterable match {
406+ case immutable.Seq () => empty[T ]
407+ case immutable.Seq (elem : T @ unchecked) => single(elem)
408+ case other => (other.knownSize: @ switch) match {
409+ case 0 => empty
410+ case 1 => single(iterable.head)
411+ case _ =>
412+ fromGraph(new IterableSource [T ](iterable)).withAttributes(DefaultAttributes .iterableSource)
413+ }
412414 }
413415
414416 /**
You can’t perform that action at this time.
0 commit comments