Roiocam commented on code in PR #989:
URL: https://github.com/apache/incubator-pekko/pull/989#discussion_r1468469688


##########
docs/src/test/java/jdocs/stream/operators/sink/ForAll.java:
##########
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package jdocs.stream.operators.sink;
+
+import org.apache.pekko.actor.ActorSystem;
+import org.apache.pekko.stream.javadsl.Sink;
+import org.apache.pekko.stream.javadsl.Source;
+
+import java.util.concurrent.TimeUnit;
+
+public class ForAll {
+  private ActorSystem system = null;
+
+  public void forAllUsage() throws Exception {
+    // #forall
+    final boolean allMatch =
+        Source.range(1, 100)
+            .runWith(Sink.forall(elem -> elem <= 100), system)
+            .toCompletableFuture()
+            .get(3, TimeUnit.SECONDS);
+    System.out.println(allMatch);

Review Comment:
   Use assert rather than STD_OUT



##########
docs/src/main/paradox/stream/operators/Sink/forall.md:
##########
@@ -0,0 +1,47 @@
+# Sink.forall
+
+A `Sink` that will test the given predicate `p` for every received element and 
completes with the result.
+
+@ref[Sink operators](../index.md#sink-operators)
+
+## Signature
+
+@apidoc[Sink.forall](Sink$) { 
scala="#forall%5BT%5D(p%3A%20T%20%3D%3E%20Boolean):org.apache.pekko.stream.scaladsl.Sink[T,scala.concurrent.Future[Boolean]]"
 java="#forall(org.apache.pekko.japi.function.Predicate)" }

Review Comment:
   ```suggestion
   @apidoc[Sink.forall](Sink$) { 
scala="#forall[T](p:T=%3EBoolean):org.apache.pekko.stream.scaladsl.Sink[T,scala.concurrent.Future[Boolean]]"
 java="#forall(org.apache.pekko.japi.function.Predicate)" }
   ```
   
   Can you update this? It can be simpler, And I have been verifyed locally.
   
   ```
   [info] compiling 81 Scala sources and 1 Java source to 
/Users/roiocam/IdeaProject/incubator-pekko/bench-jmh/target/scala-2.13/classes 
...
   [warn] Duplicate anchor [#bug-fixes] on [release-notes/index.html]
   [success] Total time: 240 s (04:00), completed 2024-1-27 21:36:02
   
   ```
   



##########
docs/src/test/scala/docs/stream/operators/sink/ForAll.scala:
##########
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package docs.stream.operators.sink
+
+import org.apache.pekko.actor.ActorSystem
+import org.apache.pekko.stream.scaladsl.{ Sink, Source }
+
+import scala.concurrent.duration.DurationInt
+import scala.concurrent.{ Await, ExecutionContextExecutor, Future }
+
+object ForAll {
+  implicit val system: ActorSystem = ???
+  implicit val ec: ExecutionContextExecutor = system.dispatcher
+  def foldExample: Unit = {
+    // #forall
+    val result: Future[Boolean] =
+      Source(1 to 100)
+        .runWith(Sink.forall(_ <= 100))
+    val allMatch = Await.result(result, 3.seconds)
+    println(allMatch)
+    // Expect prints:
+    // true
+    // #forall

Review Comment:
   Same assert issue



-- 
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]

Reply via email to