/*
 * 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 org.apache.flink.api.common.functions;

import org.apache.flink.annotation.Public;
import org.apache.flink.util.Collector;

import java.io.Serializable;

/**
 * The interface for CoGroup functions. CoGroup functions combine two data sets by first grouping
 * each data set after a key and then "joining" the groups by calling this function with the two
 * sets for each key. If a key is present in only one of the two inputs, it may be that one of the
 * groups is empty.
 *
 * <p>The basic syntax for using CoGroup on two data sets is as follows:
 *
 * <pre>{@code
 * DataSet<X> set1 = ...;
 * DataSet<Y> set2 = ...;
 *
 * set1.coGroup(set2).where(<key-definition>).equalTo(<key-definition>).with(new MyCoGroupFunction());
 * }</pre>
 *
 * <p>{@code set1} is here considered the first input, {@code set2} the second input.
 *
 * <p>Some keys may only be contained in one of the two original data sets. In that case, the
 * CoGroup function is invoked with in empty input for the side of the data set that did not contain
 * elements with that specific key.
 *
 * @param <IN1> The data type of the first input data set.
 * @param <IN2> The data type of the second input data set.
 * @param <O> The data type of the returned elements.
 */
@Public
@FunctionalInterface
public interface CoGroupFunction<IN1, IN2, O> extends Function, Serializable {

    /**
     * This method must be implemented to provide a user implementation of a coGroup. It is called
     * for each pair of element groups where the elements share the same key.
     *
     * @param first The records from the first input.
     * @param second The records from the second.
     * @param out A collector to return elements.
     * @throws Exception The function may throw Exceptions, which will cause the program to cancel,
     *     and may trigger the recovery logic.
     */
    void coGroup(Iterable<IN1> first, Iterable<IN2> second, Collector<O> out) throws Exception;
}

@@ -1036,24 +1036,34 @@
 ine two 
-data set
+%7B@code DataStream%7D
 s by fir
@@ -1064,16 +1064,19 @@
 by first
+%0A *
  groupin
@@ -1076,19 +1076,16 @@
 grouping
-%0A *
  each da
@@ -1088,18 +1088,21 @@
 h data s
-e
 t
+ream
  after a
@@ -1165,24 +1165,27 @@
 ion with
+%0A *
  the two
 %0A * sets
@@ -1176,23 +1176,23 @@
  the two
-%0A * set
+ stream
 s for ea
@@ -1264,16 +1264,19 @@
  be that
+%0A *
  one of 
@@ -1278,19 +1278,16 @@
 e of the
-%0A *
  groups 
@@ -1353,18 +1353,21 @@
 o data s
-e
 t
+ream
 s is as 
@@ -1405,17 +1405,23 @@
 ataS
-et%3CX%3E set
+tream%3CX%3E stream
 1 = 
@@ -1437,17 +1437,23 @@
 ataS
-et%3CY%3E set
+tream%3CY%3E stream
 2 = 
@@ -1464,18 +1464,21 @@
 %0A *%0A * s
-e
 t
+ream
 1.coGrou
@@ -1484,12 +1484,26 @@
 up(s
-et2)
+tream2)%0A *        
 .whe
@@ -1522,16 +1522,27 @@
 nition%3E)
+%0A *        
 .equalTo
@@ -1563,13 +1563,61 @@
 on%3E)
-.with
+%0A *        .window(%3CwindowAssigner%3E)%0A *        .apply
 (new
@@ -1667,18 +1667,21 @@
 %7B@code s
-e
 t
+ream
 1%7D is he
@@ -1719,18 +1719,21 @@
 %7B@code s
-e
 t
+ream
 2%7D the s
@@ -1819,18 +1819,21 @@
 l data s
-e
 t
+ream
 s. In th
@@ -1922,18 +1922,21 @@
 e data s
-e
 t
+ream
  that di
@@ -1940,24 +1940,27 @@
  did not
+%0A *
  contain
 %0A * elem
@@ -1951,19 +1951,16 @@
  contain
-%0A *
  element
@@ -2035,34 +2035,37 @@
 rst input data s
-e
 t
+ream
 .%0A * @param %3CIN2
@@ -2106,18 +2106,21 @@
 t data s
-e
 t
+ream
 .%0A * @pa

Update java doc to use DataStream API instead of deprecated DataSet API