This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.reflect.Field; | |
import java.util.List; | |
import java.util.UUID; | |
import org.apache.spark.SparkConf; | |
import org.apache.spark.api.java.JavaSparkContext; | |
import org.apache.spark.sql.SparkSession; | |
import org.junit.jupiter.api.extension.AfterEachCallback; | |
import org.junit.jupiter.api.extension.BeforeEachCallback; | |
import org.junit.jupiter.api.extension.ExtensionContext; | |
import org.junit.platform.commons.support.AnnotationSupport; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static org.junit.jupiter.api.Assertions.assertNotNull; | |
import org.apache.spark.api.java.JavaSparkContext; | |
import org.apache.spark.sql.SparkSession; | |
import org.junit.jupiter.api.Test; | |
import org.junit.jupiter.api.extension.ExtendWith; | |
@ExtendWith(SparkExtension.class) | |
class SparkExtensionTest { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String[] myArray = {"a", "b", "c", "d", "e"}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (int i = 0; i < myArray.length; i++) { | |
System.out.println(myArray[i]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (String element : myArray) { | |
System.out.println(element); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int i = 0; | |
while (i < myArray.length) { | |
System.out.println(myArray[i]); | |
i++; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (myArray.length > 0) { | |
int i = 0; | |
do { | |
System.out.println(myArray[i]); | |
i++; | |
} while (i < myArray.length); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Arrays.asList(myArray).stream().forEach(System.out::println); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Arrays.asList(myArray).stream().map(element -> { | |
System.out.println(element); | |
return element; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String[] transformedArray = Arrays.asList(myArray).stream().map(element - > "character: " + element).toArray(String[]::new); | |
// just to print the transformed array | |
for (int i = 0; i < transformedArray.length; i++) { | |
System.out.println(transformedArray[i]); | |
} | |
// print: a | |
// print: b | |
// print: c | |
// print: d | |
// print: e |