File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
stream/src/main/scala/org/apache/pekko/stream/scaladsl Expand file tree Collapse file tree 1 file changed +9
-7
lines changed 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