mdedetrich commented on code in PR #2429:
URL: https://github.com/apache/pekko/pull/2429#discussion_r2508010010
##########
stream/src/main/scala/org/apache/pekko/stream/scaladsl/Source.scala:
##########
@@ -437,6 +437,40 @@ object Source {
def single[T](element: T): Source[T, NotUsed] =
fromGraph(new GraphStages.SingleSource(element))
+ /**
+ * Create a `Source` from the given elements.
+ *
+ * @since 1.3.0
+ */
+ @varargs
+ @SafeVarargs
+ @SuppressWarnings(Array("varargs"))
+ def items[T](items: T*): Source[T, NotUsed] = {
+ if (items.isEmpty) {
+ empty[T]
+ } else if (items.length == 1) {
+ single(items.head)
+ } else {
+ Source(items)
+ }
+ }
+
+ /**
Review Comment:
Why is this here, we already have an apply that works with array?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]