commit
98a09f32ae
|
@ -5,9 +5,9 @@
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>JGit</artifactId>
|
<artifactId>JGit</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<name>JGit</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<url>http://maven.apache.org</url>
|
<url>http://maven.apache.org</url>
|
||||||
<name>JGit</name>
|
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>Twitter4J</artifactId>
|
<artifactId>Twitter4J</artifactId>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>Twitter4J</name>
|
<name>Twitter4J</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.typesafe.akka</groupId>
|
<groupId>com.typesafe.akka</groupId>
|
||||||
<artifactId>akka-stream_2.12</artifactId>
|
<artifactId>akka-stream_2.12</artifactId>
|
||||||
<version>2.5.11</version>
|
<version>${akka.stream.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.typesafe.akka</groupId>
|
<groupId>com.typesafe.akka</groupId>
|
||||||
|
|
|
@ -15,3 +15,5 @@
|
||||||
- [Find Substrings That Are Palindromes in Java](https://www.baeldung.com/java-palindrome-substrings)
|
- [Find Substrings That Are Palindromes in Java](https://www.baeldung.com/java-palindrome-substrings)
|
||||||
- [Find the Longest Substring without Repeating Characters](https://www.baeldung.com/java-longest-substring-without-repeated-characters)
|
- [Find the Longest Substring without Repeating Characters](https://www.baeldung.com/java-longest-substring-without-repeated-characters)
|
||||||
- [Java Two Pointer Technique](https://www.baeldung.com/java-two-pointer-technique)
|
- [Java Two Pointer Technique](https://www.baeldung.com/java-two-pointer-technique)
|
||||||
|
- [Permutations of an Array in Java](https://www.baeldung.com/java-array-permutations)
|
||||||
|
- [Implementing Simple State Machines with Java Enums](https://www.baeldung.com/java-enum-simple-state-machine)
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>cobertura-maven-plugin</artifactId>
|
<artifactId>cobertura-maven-plugin</artifactId>
|
||||||
<version>2.7</version>
|
<version>${cobertura-maven-plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<instrumentation>
|
<instrumentation>
|
||||||
<ignores>
|
<ignores>
|
||||||
|
@ -91,6 +91,7 @@
|
||||||
<org.jgrapht.ext.version>1.0.1</org.jgrapht.ext.version>
|
<org.jgrapht.ext.version>1.0.1</org.jgrapht.ext.version>
|
||||||
<org.assertj.core.version>3.9.0</org.assertj.core.version>
|
<org.assertj.core.version>3.9.0</org.assertj.core.version>
|
||||||
<commons-codec.version>1.11</commons-codec.version>
|
<commons-codec.version>1.11</commons-codec.version>
|
||||||
|
<cobertura-maven-plugin.version>2.7</cobertura-maven-plugin.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
Binary file not shown.
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 9.4 KiB |
|
@ -3,9 +3,9 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>animal-sniffer-mvn-plugin</artifactId>
|
<artifactId>animal-sniffer-mvn-plugin</artifactId>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<name>animal-sniffer-mvn-plugin</name>
|
<name>animal-sniffer-mvn-plugin</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
<url>http://maven.apache.org</url>
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>annotations</artifactId>
|
<artifactId>annotations</artifactId>
|
||||||
<packaging>pom</packaging>
|
|
||||||
<name>annotations</name>
|
<name>annotations</name>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>parent-modules</artifactId>
|
<artifactId>parent-modules</artifactId>
|
||||||
|
|
|
@ -7,14 +7,6 @@
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<name>apache-avro</name>
|
<name>apache-avro</name>
|
||||||
|
|
||||||
<properties>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
<compiler-plugin.version>3.5</compiler-plugin.version>
|
|
||||||
<avro.version>1.8.2</avro.version>
|
|
||||||
<java.version>1.8</java.version>
|
|
||||||
<slf4j.version>1.7.25</slf4j.version>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>parent-modules</artifactId>
|
<artifactId>parent-modules</artifactId>
|
||||||
|
@ -85,4 +77,13 @@
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<compiler-plugin.version>3.5</compiler-plugin.version>
|
||||||
|
<avro.version>1.8.2</avro.version>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
<slf4j.version>1.7.25</slf4j.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>apache-curator</artifactId>
|
<artifactId>apache-curator</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>apache-curator</name>
|
<name>apache-curator</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
|
|
@ -13,22 +13,6 @@
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<properties>
|
|
||||||
<geode.core>1.6.0</geode.core>
|
|
||||||
</properties>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<source>1.8</source>
|
|
||||||
<target>1.8</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.geode</groupId>
|
<groupId>org.apache.geode</groupId>
|
||||||
|
@ -38,8 +22,26 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>RELEASE</version>
|
<version>${junit.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<source>${maven.compiler.source}</source>
|
||||||
|
<target>${maven.compiler.target}</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<geode.core>1.6.0</geode.core>
|
||||||
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
</project>
|
</project>
|
|
@ -7,51 +7,58 @@
|
||||||
<name>apache-meecrowave</name>
|
<name>apache-meecrowave</name>
|
||||||
<description>A sample REST API application with Meecrowave</description>
|
<description>A sample REST API application with Meecrowave</description>
|
||||||
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
|
||||||
</properties>
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<!-- https://mvnrepository.com/artifact/org.apache.meecrowave/meecrowave-core -->
|
<!-- https://mvnrepository.com/artifact/org.apache.meecrowave/meecrowave-core -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.meecrowave</groupId>
|
<groupId>org.apache.meecrowave</groupId>
|
||||||
<artifactId>meecrowave-core</artifactId>
|
<artifactId>meecrowave-core</artifactId>
|
||||||
<version>1.2.1</version>
|
<version>${meecrowave-core.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/org.apache.meecrowave/meecrowave-jpa -->
|
<!-- https://mvnrepository.com/artifact/org.apache.meecrowave/meecrowave-jpa -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.meecrowave</groupId>
|
<groupId>org.apache.meecrowave</groupId>
|
||||||
<artifactId>meecrowave-jpa</artifactId>
|
<artifactId>meecrowave-jpa</artifactId>
|
||||||
<version>1.2.1</version>
|
<version>${meecrowave-jpa.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.squareup.okhttp3</groupId>
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
<artifactId>okhttp</artifactId>
|
<artifactId>okhttp</artifactId>
|
||||||
<version>3.10.0</version>
|
<version>${okhttp.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.meecrowave</groupId>
|
<groupId>org.apache.meecrowave</groupId>
|
||||||
<artifactId>meecrowave-junit</artifactId>
|
<artifactId>meecrowave-junit</artifactId>
|
||||||
<version>1.2.0</version>
|
<version>${meecrowave-junit.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- https://mvnrepository.com/artifact/junit/junit -->
|
<!-- https://mvnrepository.com/artifact/junit/junit -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>4.10</version>
|
<version>${junit.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.meecrowave</groupId>
|
<groupId>org.apache.meecrowave</groupId>
|
||||||
<artifactId>meecrowave-maven-plugin</artifactId>
|
<artifactId>meecrowave-maven-plugin</artifactId>
|
||||||
<version>1.2.1</version>
|
<version>${meecrowave-maven-plugin.version}</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
|
<junit.version>4.10</junit.version>
|
||||||
|
<meecrowave-junit.version>1.2.0</meecrowave-junit.version>
|
||||||
|
<okhttp.version>3.10.0</okhttp.version>
|
||||||
|
<meecrowave-jpa.version>1.2.1</meecrowave-jpa.version>
|
||||||
|
<meecrowave-core.version>1.2.1</meecrowave-core.version>
|
||||||
|
<meecrowave-maven-plugin.version>1.2.1</meecrowave-maven-plugin.version>
|
||||||
|
</properties>
|
||||||
</project>
|
</project>
|
|
@ -11,12 +11,14 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.pulsar</groupId>
|
<groupId>org.apache.pulsar</groupId>
|
||||||
<artifactId>pulsar-client</artifactId>
|
<artifactId>pulsar-client</artifactId>
|
||||||
<version>2.1.1-incubating</version>
|
<version>${pulsar-client.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
<pulsar-client.version>2.1.1-incubating</pulsar-client.version>
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>apache-solrj</artifactId>
|
<artifactId>apache-solrj</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>apache-solrj</name>
|
<name>apache-solrj</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
### Relevant articles
|
### Relevant articles
|
||||||
|
|
||||||
- [Introduction to Apache Spark](http://www.baeldung.com/apache-spark)
|
- [Introduction to Apache Spark](http://www.baeldung.com/apache-spark)
|
||||||
|
- [Building a Data Pipeline with Kafka, Spark Streaming and Cassandra](https://www.baeldung.com/kafka-spark-data-pipeline)
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>apache-spark</artifactId>
|
<artifactId>apache-spark</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>apache-spark</name>
|
<name>apache-spark</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
<url>http://maven.apache.org</url>
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
|
@ -54,10 +54,10 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.2</version>
|
<version>${maven-compiler-plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.8</source>
|
<source>${maven.compiler.source}</source>
|
||||||
<target>1.8</target>
|
<target>${maven.compiler.target}</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
@ -85,6 +85,9 @@
|
||||||
<org.apache.spark.spark-streaming-kafka.version>2.3.0</org.apache.spark.spark-streaming-kafka.version>
|
<org.apache.spark.spark-streaming-kafka.version>2.3.0</org.apache.spark.spark-streaming-kafka.version>
|
||||||
<com.datastax.spark.spark-cassandra-connector.version>2.3.0</com.datastax.spark.spark-cassandra-connector.version>
|
<com.datastax.spark.spark-cassandra-connector.version>2.3.0</com.datastax.spark.spark-cassandra-connector.version>
|
||||||
<com.datastax.spark.spark-cassandra-connector-java.version>1.5.2</com.datastax.spark.spark-cassandra-connector-java.version>
|
<com.datastax.spark.spark-cassandra-connector-java.version>1.5.2</com.datastax.spark.spark-cassandra-connector-java.version>
|
||||||
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
|
<maven-compiler-plugin.version>3.2</maven-compiler-plugin.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<version>0.1-SNAPSHOT</version>
|
<version>0.1-SNAPSHOT</version>
|
||||||
<artifactId>apache-velocity</artifactId>
|
<artifactId>apache-velocity</artifactId>
|
||||||
<packaging>war</packaging>
|
|
||||||
<name>apache-velocity</name>
|
<name>apache-velocity</name>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>aws-lambda</artifactId>
|
<artifactId>aws-lambda</artifactId>
|
||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>aws-lambda</name>
|
<name>aws-lambda</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>parent-modules</artifactId>
|
<artifactId>parent-modules</artifactId>
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>aws</artifactId>
|
<artifactId>aws</artifactId>
|
||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>aws</name>
|
<name>aws</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-autoconfigure</artifactId>
|
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||||
<version>2.1.1.RELEASE</version>
|
<version>${spring-boot.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>azure</artifactId>
|
<artifactId>azure</artifactId>
|
||||||
<version>0.1</version>
|
<version>0.1</version>
|
||||||
<packaging>war</packaging>
|
|
||||||
<name>azure</name>
|
<name>azure</name>
|
||||||
<description>Demo project for Spring Boot on Azure</description>
|
<description>Demo project for Spring Boot on Azure</description>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>parent-boot-2</artifactId>
|
<artifactId>parent-boot-2</artifactId>
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>blade</artifactId>
|
|
||||||
<name>blade</name>
|
|
||||||
|
|
||||||
<!-- WITH THIS mvn integration-test DOES WORK -->
|
<!-- WITH THIS mvn integration-test DOES WORK -->
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
<artifactId>blade</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>1.0.0-SNAPSHOT</version>
|
||||||
|
<name>blade</name>
|
||||||
|
|
||||||
|
|
||||||
<!-- WITH THIS mvn integration-test DOESN'T WORK -->
|
<!-- WITH THIS mvn integration-test DOESN'T WORK -->
|
||||||
<!-- <parent> -->
|
<!-- <parent> -->
|
||||||
|
@ -17,35 +17,30 @@
|
||||||
<!-- <version>1.0.0-SNAPSHOT</version> -->
|
<!-- <version>1.0.0-SNAPSHOT</version> -->
|
||||||
<!-- </parent> -->
|
<!-- </parent> -->
|
||||||
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.bladejava</groupId>
|
<groupId>com.bladejava</groupId>
|
||||||
<artifactId>blade-mvc</artifactId>
|
<artifactId>blade-mvc</artifactId>
|
||||||
<version>2.0.14.RELEASE</version>
|
<version>${blade-mvc.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.webjars</groupId>
|
<groupId>org.webjars</groupId>
|
||||||
<artifactId>bootstrap</artifactId>
|
<artifactId>bootstrap</artifactId>
|
||||||
<version>4.2.1</version>
|
<version>${bootstrap.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
<version>3.8.1</version>
|
<version>${commons-lang3.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- PROVIDED -->
|
<!-- PROVIDED -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>1.18.4</version>
|
<version>${lombok.version}</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
@ -53,31 +48,31 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>4.12</version>
|
<version>${junit.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.assertj</groupId>
|
<groupId>org.assertj</groupId>
|
||||||
<artifactId>assertj-core</artifactId>
|
<artifactId>assertj-core</artifactId>
|
||||||
<version>3.11.1</version>
|
<version>${assertj-core.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.httpcomponents</groupId>
|
<groupId>org.apache.httpcomponents</groupId>
|
||||||
<artifactId>httpclient</artifactId>
|
<artifactId>httpclient</artifactId>
|
||||||
<version>4.5.6</version>
|
<version>${httpclient.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.httpcomponents</groupId>
|
<groupId>org.apache.httpcomponents</groupId>
|
||||||
<artifactId>httpmime</artifactId>
|
<artifactId>httpmime</artifactId>
|
||||||
<version>4.5.6</version>
|
<version>${httpmime.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.httpcomponents</groupId>
|
<groupId>org.apache.httpcomponents</groupId>
|
||||||
<artifactId>httpcore</artifactId>
|
<artifactId>httpcore</artifactId>
|
||||||
<version>4.4.10</version>
|
<version>${httpcore.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -88,6 +83,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>${maven-surefire-plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<forkCount>3</forkCount>
|
<forkCount>3</forkCount>
|
||||||
<reuseForks>true</reuseForks>
|
<reuseForks>true</reuseForks>
|
||||||
|
@ -100,7 +96,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-failsafe-plugin</artifactId>
|
<artifactId>maven-failsafe-plugin</artifactId>
|
||||||
<version>3.0.0-M3</version>
|
<version>${maven-failsafe-plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<includes>
|
<includes>
|
||||||
<include>**/*LiveTest.java</include>
|
<include>**/*LiveTest.java</include>
|
||||||
|
@ -119,7 +115,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>com.bazaarvoice.maven.plugins</groupId>
|
<groupId>com.bazaarvoice.maven.plugins</groupId>
|
||||||
<artifactId>process-exec-maven-plugin</artifactId>
|
<artifactId>process-exec-maven-plugin</artifactId>
|
||||||
<version>0.7</version>
|
<version>${process-exec-maven-plugin.version}</version>
|
||||||
<executions>
|
<executions>
|
||||||
<!--Start Blade -->
|
<!--Start Blade -->
|
||||||
<execution>
|
<execution>
|
||||||
|
@ -177,13 +173,33 @@
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>${maven-compiler-plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.8</source>
|
<source>${maven.compiler.source}</source>
|
||||||
<target>1.8</target>
|
<target>${maven.compiler.target}</target>
|
||||||
<encoding>UTF-8</encoding>
|
<encoding>UTF-8</encoding>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
|
<blade-mvc.version>2.0.14.RELEASE</blade-mvc.version>
|
||||||
|
<bootstrap.version>4.2.1</bootstrap.version>
|
||||||
|
<commons-lang3.version>3.8.1</commons-lang3.version>
|
||||||
|
<lombok.version>1.18.4</lombok.version>
|
||||||
|
<junit.version>4.12</junit.version>
|
||||||
|
<httpclient.version>4.5.6</httpclient.version>
|
||||||
|
<httpmime.version>4.5.6</httpmime.version>
|
||||||
|
<httpcore.version>4.4.10</httpcore.version>
|
||||||
|
<assertj-core.version>3.11.1</assertj-core.version>
|
||||||
|
<maven-failsafe-plugin.version>3.0.0-M3</maven-failsafe-plugin.version>
|
||||||
|
<process-exec-maven-plugin.version>0.7</process-exec-maven-plugin.version>
|
||||||
|
<maven-surefire-plugin.version>2.21.0</maven-surefire-plugin.version>
|
||||||
|
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
|
||||||
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.baeldung.bootique</groupId>
|
<groupId>com.baeldung.bootique</groupId>
|
||||||
<artifactId>bootique</artifactId>
|
<artifactId>bootique</artifactId>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<name>bootique</name>
|
<name>bootique</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
<url>http://maven.apache.org</url>
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>cas-secured-app</artifactId>
|
<artifactId>cas-secured-app</artifactId>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>cas-secured-app</name>
|
<name>cas-secured-app</name>
|
||||||
<description>Demo project for CAS</description>
|
<description>Demo project for CAS</description>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>parent-boot-1</artifactId>
|
<artifactId>parent-boot-1</artifactId>
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<cdi-api.version>2.0.SP1</cdi-api.version>
|
<cdi-api.version>2.0.SP1</cdi-api.version>
|
||||||
<weld-se-core.version>3.0.5.Final</weld-se-core.version>
|
<weld-se-core.version>3.0.5.Final</weld-se-core.version>
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>checker-plugin</artifactId>
|
<artifactId>checker-plugin</artifactId>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<name>checker-plugin</name>
|
<name>checker-plugin</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
<url>http://maven.apache.org</url>
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
|
|
|
@ -0,0 +1,107 @@
|
||||||
|
package com.baeldung.file
|
||||||
|
|
||||||
|
class ReadFile {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* reads file content line by line using withReader and reader.readLine
|
||||||
|
* @param filePath
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int readFileLineByLine(String filePath) {
|
||||||
|
File file = new File(filePath)
|
||||||
|
def line, noOfLines = 0;
|
||||||
|
file.withReader { reader ->
|
||||||
|
while ((line = reader.readLine())!=null)
|
||||||
|
{
|
||||||
|
println "${line}"
|
||||||
|
noOfLines++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return noOfLines
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* reads file content in list of lines
|
||||||
|
* @param filePath
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<String> readFileInList(String filePath) {
|
||||||
|
File file = new File(filePath)
|
||||||
|
def lines = file.readLines()
|
||||||
|
return lines
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* reads file content in string using File.text
|
||||||
|
* @param filePath
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String readFileString(String filePath) {
|
||||||
|
File file = new File(filePath)
|
||||||
|
String fileContent = file.text
|
||||||
|
return fileContent
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* reads file content in string with encoding using File.getText
|
||||||
|
* @param filePath
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String readFileStringWithCharset(String filePath) {
|
||||||
|
File file = new File(filePath)
|
||||||
|
String utf8Content = file.getText("UTF-8")
|
||||||
|
return utf8Content
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* reads content of binary file and returns byte array
|
||||||
|
* @param filePath
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
byte[] readBinaryFile(String filePath) {
|
||||||
|
File file = new File(filePath)
|
||||||
|
byte[] binaryContent = file.bytes
|
||||||
|
return binaryContent
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* More Examples of reading a file
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
def moreExamples() {
|
||||||
|
|
||||||
|
//with reader with utf-8
|
||||||
|
new File("src/main/resources/utf8Content.html").withReader('UTF-8') { reader ->
|
||||||
|
def line
|
||||||
|
while ((line = reader.readLine())!=null) {
|
||||||
|
println "${line}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//collect api
|
||||||
|
def list = new File("src/main/resources/fileContent.txt").collect {it}
|
||||||
|
|
||||||
|
//as operator
|
||||||
|
def array = new File("src/main/resources/fileContent.txt") as String[]
|
||||||
|
|
||||||
|
//eachline
|
||||||
|
new File("src/main/resources/fileContent.txt").eachLine { line ->
|
||||||
|
println line
|
||||||
|
}
|
||||||
|
|
||||||
|
//newInputStream with eachLine
|
||||||
|
def is = new File("src/main/resources/fileContent.txt").newInputStream()
|
||||||
|
is.eachLine {
|
||||||
|
println it
|
||||||
|
}
|
||||||
|
is.close()
|
||||||
|
|
||||||
|
//withInputStream
|
||||||
|
new File("src/main/resources/fileContent.txt").withInputStream { stream ->
|
||||||
|
stream.eachLine { line ->
|
||||||
|
println line
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
Line 1 : Hello World!!!
|
||||||
|
Line 2 : This is a file content.
|
||||||
|
Line 3 : String content
|
Binary file not shown.
After Width: | Height: | Size: 329 B |
|
@ -0,0 +1,12 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<body>
|
||||||
|
<pre>
|
||||||
|
ᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗ
|
||||||
|
ᛋᚳᛖᚪᛚ᛫ᚦᛖᚪᚻ᛫ᛗᚪᚾᚾᚪ᛫ᚷᛖᚻᚹᛦᛚᚳ᛫ᛗᛁᚳᛚᚢᚾ᛫ᚻᛦᛏ᛫ᛞᚫᛚᚪᚾ
|
||||||
|
ᚷᛁᚠ᛫ᚻᛖ᛫ᚹᛁᛚᛖ᛫ᚠᚩᚱ᛫ᛞᚱᛁᚻᛏᚾᛖ᛫ᛞᚩᛗᛖᛋ᛫ᚻᛚᛇᛏᚪᚾ
|
||||||
|
</pre>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,70 @@
|
||||||
|
package com.baeldung.file
|
||||||
|
|
||||||
|
import spock.lang.Specification
|
||||||
|
|
||||||
|
class ReadFileUnitTest extends Specification {
|
||||||
|
|
||||||
|
ReadFile readFile
|
||||||
|
|
||||||
|
void setup () {
|
||||||
|
readFile = new ReadFile()
|
||||||
|
}
|
||||||
|
|
||||||
|
def 'Should return number of lines in File using ReadFile.readFileLineByLine given filePath' () {
|
||||||
|
given:
|
||||||
|
def filePath = "src/main/resources/fileContent.txt"
|
||||||
|
when:
|
||||||
|
def noOfLines = readFile.readFileLineByLine(filePath)
|
||||||
|
then:
|
||||||
|
noOfLines
|
||||||
|
noOfLines instanceof Integer
|
||||||
|
assert noOfLines, 3
|
||||||
|
}
|
||||||
|
|
||||||
|
def 'Should return File Content in list of lines using ReadFile.readFileInList given filePath' () {
|
||||||
|
given:
|
||||||
|
def filePath = "src/main/resources/fileContent.txt"
|
||||||
|
when:
|
||||||
|
def lines = readFile.readFileInList(filePath)
|
||||||
|
then:
|
||||||
|
lines
|
||||||
|
lines instanceof List<String>
|
||||||
|
assert lines.size(), 3
|
||||||
|
}
|
||||||
|
|
||||||
|
def 'Should return file content in string using ReadFile.readFileString given filePath' () {
|
||||||
|
given:
|
||||||
|
def filePath = "src/main/resources/fileContent.txt"
|
||||||
|
when:
|
||||||
|
def fileContent = readFile.readFileString(filePath)
|
||||||
|
then:
|
||||||
|
fileContent
|
||||||
|
fileContent instanceof String
|
||||||
|
fileContent.contains("""Line 1 : Hello World!!!
|
||||||
|
Line 2 : This is a file content.
|
||||||
|
Line 3 : String content""")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
def 'Should return UTF-8 encoded file content in string using ReadFile.readFileStringWithCharset given filePath' () {
|
||||||
|
given:
|
||||||
|
def filePath = "src/main/resources/utf8Content.html"
|
||||||
|
when:
|
||||||
|
def encodedContent = readFile.readFileStringWithCharset(filePath)
|
||||||
|
then:
|
||||||
|
encodedContent
|
||||||
|
encodedContent instanceof String
|
||||||
|
}
|
||||||
|
|
||||||
|
def 'Should return binary file content in byte array using ReadFile.readBinaryFile given filePath' () {
|
||||||
|
given:
|
||||||
|
def filePath = "src/main/resources/sample.png"
|
||||||
|
when:
|
||||||
|
def binaryContent = readFile.readBinaryFile(filePath)
|
||||||
|
then:
|
||||||
|
binaryContent
|
||||||
|
binaryContent instanceof byte[]
|
||||||
|
binaryContent.length == 329
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -3,9 +3,9 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>core-java-10</artifactId>
|
<artifactId>core-java-10</artifactId>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
<name>core-java-10</name>
|
<name>core-java-10</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
<url>http://maven.apache.org</url>
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
|
|
|
@ -3,3 +3,4 @@
|
||||||
- [Java 11 Single File Source Code](https://www.baeldung.com/java-single-file-source-code)
|
- [Java 11 Single File Source Code](https://www.baeldung.com/java-single-file-source-code)
|
||||||
- [Java 11 Local Variable Syntax for Lambda Parameters](https://www.baeldung.com/java-var-lambda-params)
|
- [Java 11 Local Variable Syntax for Lambda Parameters](https://www.baeldung.com/java-var-lambda-params)
|
||||||
- [Java 11 String API Additions](https://www.baeldung.com/java-11-string-api)
|
- [Java 11 String API Additions](https://www.baeldung.com/java-11-string-api)
|
||||||
|
- [Java 11 Nest Based Access Control](https://www.baeldung.com/java-nest-based-access-control)
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>core-java-11</artifactId>
|
<artifactId>core-java-11</artifactId>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
<name>core-java-11</name>
|
<name>core-java-11</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
<url>http://maven.apache.org</url>
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>core-java-8</artifactId>
|
<artifactId>core-java-8</artifactId>
|
||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>core-java-8</name>
|
<name>core-java-8</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
|
|
@ -39,6 +39,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||||
public class Java8CollectorsUnitTest {
|
public class Java8CollectorsUnitTest {
|
||||||
|
|
||||||
private final List<String> givenList = Arrays.asList("a", "bb", "ccc", "dd");
|
private final List<String> givenList = Arrays.asList("a", "bb", "ccc", "dd");
|
||||||
|
private final List<String> listWithDuplicates = Arrays.asList("a", "bb", "c", "d", "bb");
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenCollectingToList_shouldCollectToList() throws Exception {
|
public void whenCollectingToList_shouldCollectToList() throws Exception {
|
||||||
|
@ -48,12 +49,19 @@ public class Java8CollectorsUnitTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenCollectingToList_shouldCollectToSet() throws Exception {
|
public void whenCollectingToSet_shouldCollectToSet() throws Exception {
|
||||||
final Set<String> result = givenList.stream().collect(toSet());
|
final Set<String> result = givenList.stream().collect(toSet());
|
||||||
|
|
||||||
assertThat(result).containsAll(givenList);
|
assertThat(result).containsAll(givenList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenContainsDuplicateElements_whenCollectingToSet_shouldAddDuplicateElementsOnlyOnce() throws Exception {
|
||||||
|
final Set<String> result = listWithDuplicates.stream().collect(toSet());
|
||||||
|
|
||||||
|
assertThat(result).hasSize(4);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenCollectingToCollection_shouldCollectToCollection() throws Exception {
|
public void whenCollectingToCollection_shouldCollectToCollection() throws Exception {
|
||||||
final List<String> result = givenList.stream().collect(toCollection(LinkedList::new));
|
final List<String> result = givenList.stream().collect(toCollection(LinkedList::new));
|
||||||
|
@ -83,6 +91,13 @@ public class Java8CollectorsUnitTest {
|
||||||
assertThat(result).containsEntry("a", 1).containsEntry("bb", 2).containsEntry("ccc", 3).containsEntry("dd", 2);
|
assertThat(result).containsEntry("a", 1).containsEntry("bb", 2).containsEntry("ccc", 3).containsEntry("dd", 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenContainsDuplicateElements_whenCollectingToMap_shouldThrowException() throws Exception {
|
||||||
|
assertThatThrownBy(() -> {
|
||||||
|
listWithDuplicates.stream().collect(toMap(Function.identity(), String::length));
|
||||||
|
}).isInstanceOf(IllegalStateException.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenCollectingAndThen_shouldCollect() throws Exception {
|
public void whenCollectingAndThen_shouldCollect() throws Exception {
|
||||||
final List<String> result = givenList.stream().collect(collectingAndThen(toList(), ImmutableList::copyOf));
|
final List<String> result = givenList.stream().collect(collectingAndThen(toList(), ImmutableList::copyOf));
|
||||||
|
|
|
@ -5,9 +5,10 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
public class MethodReferenceExamples {
|
public class MethodReferenceUnitTest {
|
||||||
|
|
||||||
private static <T> void doNothingAtAll(Object... o) {
|
private static <T> void doNothingAtAll(Object... o) {
|
||||||
}
|
}
|
||||||
|
@ -17,10 +18,8 @@ public class MethodReferenceExamples {
|
||||||
@Test
|
@Test
|
||||||
public void referenceToStaticMethod() {
|
public void referenceToStaticMethod() {
|
||||||
List<String> messages = Arrays.asList("Hello", "Baeldung", "readers!");
|
List<String> messages = Arrays.asList("Hello", "Baeldung", "readers!");
|
||||||
messages.forEach((word) -> {
|
messages.forEach(word -> StringUtils.capitalize(word));
|
||||||
System.out.println(word);
|
messages.forEach(StringUtils::capitalize);
|
||||||
});
|
|
||||||
messages.forEach(System.out::println);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -63,7 +62,7 @@ public class MethodReferenceExamples {
|
||||||
@Test
|
@Test
|
||||||
public void limitationsAndAdditionalExamples() {
|
public void limitationsAndAdditionalExamples() {
|
||||||
createBicyclesList().forEach(b -> System.out.printf("Bike brand is '%s' and frame size is '%d'%n", b.getBrand(), b.getFrameSize()));
|
createBicyclesList().forEach(b -> System.out.printf("Bike brand is '%s' and frame size is '%d'%n", b.getBrand(), b.getFrameSize()));
|
||||||
createBicyclesList().forEach((o) -> MethodReferenceExamples.doNothingAtAll(o));
|
createBicyclesList().forEach((o) -> MethodReferenceUnitTest.doNothingAtAll(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Bicycle> createBicyclesList() {
|
private List<Bicycle> createBicyclesList() {
|
|
@ -26,3 +26,4 @@
|
||||||
- [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap)
|
- [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap)
|
||||||
- [Java 9 Platform Logging API](https://www.baeldung.com/java-9-logging-api)
|
- [Java 9 Platform Logging API](https://www.baeldung.com/java-9-logging-api)
|
||||||
- [Guide to java.lang.Process API](https://www.baeldung.com/java-process-api)
|
- [Guide to java.lang.Process API](https://www.baeldung.com/java-process-api)
|
||||||
|
- [Immutable Set in Java](https://www.baeldung.com/java-immutable-set)
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
cd src/main/java
|
||||||
|
javac com/baeldung/java9/aot/JaotCompilation.java
|
||||||
|
jaotc --output jaotCompilation.so com/baeldung/java9/aot/JaotCompilation.class
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
cd src/main/java
|
||||||
|
java -XX:AOTLibrary=./jaotCompilation.so com/baeldung/java9/aot/JaotCompilation
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.baeldung.java9.aot;
|
||||||
|
|
||||||
|
public class JaotCompilation {
|
||||||
|
|
||||||
|
public static void main(String[] argv) {
|
||||||
|
System.out.println(message());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String message() {
|
||||||
|
return "The JAOT compiler says 'Hello'";
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,3 +14,4 @@
|
||||||
- [Array Operations in Java](http://www.baeldung.com/java-common-array-operations)
|
- [Array Operations in Java](http://www.baeldung.com/java-common-array-operations)
|
||||||
- [Intersection Between two Integer Arrays](https://www.baeldung.com/java-array-intersection)
|
- [Intersection Between two Integer Arrays](https://www.baeldung.com/java-array-intersection)
|
||||||
- [Sorting Arrays in Java](https://www.baeldung.com/java-sorting-arrays)
|
- [Sorting Arrays in Java](https://www.baeldung.com/java-sorting-arrays)
|
||||||
|
- [Convert a Float to a Byte Array in Java](https://www.baeldung.com/java-convert-float-to-byte-array)
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>core-java-arrays</artifactId>
|
<artifactId>core-java-arrays</artifactId>
|
||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>core-java-arrays</name>
|
<name>core-java-arrays</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>core-java-collections-list</artifactId>
|
<artifactId>core-java-collections-list</artifactId>
|
||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>core-java-collections-list</name>
|
<name>core-java-collections-list</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
@ -40,17 +40,17 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.sf.trove4j</groupId>
|
<groupId>net.sf.trove4j</groupId>
|
||||||
<artifactId>trove4j</artifactId>
|
<artifactId>trove4j</artifactId>
|
||||||
<version>3.0.2</version>
|
<version>${trove4j.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>it.unimi.dsi</groupId>
|
<groupId>it.unimi.dsi</groupId>
|
||||||
<artifactId>fastutil</artifactId>
|
<artifactId>fastutil</artifactId>
|
||||||
<version>8.1.0</version>
|
<version>${fastutil.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>colt</groupId>
|
<groupId>colt</groupId>
|
||||||
<artifactId>colt</artifactId>
|
<artifactId>colt</artifactId>
|
||||||
<version>1.2.0</version>
|
<version>${colt.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -60,5 +60,8 @@
|
||||||
<avaitility.version>1.7.0</avaitility.version>
|
<avaitility.version>1.7.0</avaitility.version>
|
||||||
<assertj.version>3.11.1</assertj.version>
|
<assertj.version>3.11.1</assertj.version>
|
||||||
<lombok.version>1.16.12</lombok.version>
|
<lombok.version>1.16.12</lombok.version>
|
||||||
|
<trove4j.version>3.0.2</trove4j.version>
|
||||||
|
<fastutil.version>8.1.0</fastutil.version>
|
||||||
|
<colt.version>1.2.0</colt.version>
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -31,3 +31,4 @@
|
||||||
- [A Guide to EnumMap](https://www.baeldung.com/java-enum-map)
|
- [A Guide to EnumMap](https://www.baeldung.com/java-enum-map)
|
||||||
- [A Guide to Iterator in Java](http://www.baeldung.com/java-iterator)
|
- [A Guide to Iterator in Java](http://www.baeldung.com/java-iterator)
|
||||||
- [Differences Between HashMap and Hashtable](https://www.baeldung.com/hashmap-hashtable-differences)
|
- [Differences Between HashMap and Hashtable](https://www.baeldung.com/hashmap-hashtable-differences)
|
||||||
|
- [Java ArrayList vs Vector](https://www.baeldung.com/java-arraylist-vs-vector)
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>core-java-collections</artifactId>
|
<artifactId>core-java-collections</artifactId>
|
||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>core-java-collections</name>
|
<name>core-java-collections</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-exec</artifactId>
|
<artifactId>commons-exec</artifactId>
|
||||||
<version>1.3</version>
|
<version>${commons-exec.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
|
@ -74,5 +74,6 @@
|
||||||
<assertj.version>3.11.1</assertj.version>
|
<assertj.version>3.11.1</assertj.version>
|
||||||
<eclipse.collections.version>7.1.0</eclipse.collections.version>
|
<eclipse.collections.version>7.1.0</eclipse.collections.version>
|
||||||
<lombok.version>1.16.12</lombok.version>
|
<lombok.version>1.16.12</lombok.version>
|
||||||
|
<commons-exec.version>1.3</commons-exec.version>
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
package com.baeldung.charstack;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
|
||||||
|
public class CharStack {
|
||||||
|
|
||||||
|
private LinkedList<Character> items;
|
||||||
|
|
||||||
|
public CharStack() {
|
||||||
|
this.items = new LinkedList<Character>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void push(Character item) {
|
||||||
|
items.push(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Character peek() {
|
||||||
|
return items.getFirst();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Character pop() {
|
||||||
|
|
||||||
|
Iterator<Character> iter = items.iterator();
|
||||||
|
Character item = iter.next();
|
||||||
|
if (item != null) {
|
||||||
|
iter.remove();
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int size() {
|
||||||
|
return items.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
package com.baeldung.charstack;
|
||||||
|
|
||||||
|
public class CharStackWithArray {
|
||||||
|
|
||||||
|
private char[] elements;
|
||||||
|
private int size;
|
||||||
|
|
||||||
|
public CharStackWithArray() {
|
||||||
|
size = 0;
|
||||||
|
elements = new char[4];
|
||||||
|
}
|
||||||
|
|
||||||
|
public int size() {
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public char peek() {
|
||||||
|
if (size == 0) {
|
||||||
|
throw new EmptyStackException();
|
||||||
|
}
|
||||||
|
return elements[size - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
public char pop() {
|
||||||
|
if (size == 0) {
|
||||||
|
throw new EmptyStackException();
|
||||||
|
}
|
||||||
|
|
||||||
|
return elements[--size];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void push(char item) {
|
||||||
|
ensureCapacity(size + 1);
|
||||||
|
elements[size] = item;
|
||||||
|
size++;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ensureCapacity(int newSize) {
|
||||||
|
char newBiggerArray[];
|
||||||
|
|
||||||
|
if (elements.length < newSize) {
|
||||||
|
newBiggerArray = new char[elements.length * 2];
|
||||||
|
System.arraycopy(elements, 0, newBiggerArray, 0, size);
|
||||||
|
elements = newBiggerArray;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.baeldung.charstack;
|
||||||
|
|
||||||
|
public class EmptyStackException extends RuntimeException {
|
||||||
|
|
||||||
|
public EmptyStackException() {
|
||||||
|
super("Stack is empty");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.baeldung.queueinterface;
|
package com.baeldung.queueInterface;
|
||||||
|
|
||||||
import java.util.AbstractQueue;
|
import java.util.AbstractQueue;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
package com.baeldung.charstack;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
public class CharStackUnitTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenCharStackIsCreated_thenItHasSize0() {
|
||||||
|
|
||||||
|
CharStack charStack = new CharStack();
|
||||||
|
|
||||||
|
assertEquals(0, charStack.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenEmptyCharStack_whenElementIsPushed_thenStackSizeisIncreased() {
|
||||||
|
|
||||||
|
CharStack charStack = new CharStack();
|
||||||
|
|
||||||
|
charStack.push('A');
|
||||||
|
|
||||||
|
assertEquals(1, charStack.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenCharStack_whenElementIsPoppedFromStack_thenElementIsRemovedAndSizeChanges() {
|
||||||
|
|
||||||
|
CharStack charStack = new CharStack();
|
||||||
|
charStack.push('A');
|
||||||
|
|
||||||
|
char element = charStack.pop();
|
||||||
|
|
||||||
|
assertEquals('A', element);
|
||||||
|
assertEquals(0, charStack.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenCharStack_whenElementIsPeeked_thenElementIsNotRemovedAndSizeDoesNotChange() {
|
||||||
|
CharStack charStack = new CharStack();
|
||||||
|
charStack.push('A');
|
||||||
|
|
||||||
|
char element = charStack.peek();
|
||||||
|
|
||||||
|
assertEquals('A', element);
|
||||||
|
assertEquals(1, charStack.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.baeldung.charstack;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
import java.util.Stack;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
public class CharStackUsingJavaUnitTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenCharStackIsCreated_thenItHasSize0() {
|
||||||
|
|
||||||
|
Stack<Character> charStack = new Stack<>();
|
||||||
|
|
||||||
|
assertEquals(0, charStack.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenEmptyCharStack_whenElementIsPushed_thenStackSizeisIncreased() {
|
||||||
|
|
||||||
|
Stack<Character> charStack = new Stack<>();
|
||||||
|
|
||||||
|
charStack.push('A');
|
||||||
|
|
||||||
|
assertEquals(1, charStack.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenCharStack_whenElementIsPoppedFromStack_thenElementIsRemovedAndSizeChanges() {
|
||||||
|
|
||||||
|
Stack<Character> charStack = new Stack<>();
|
||||||
|
charStack.push('A');
|
||||||
|
|
||||||
|
char element = charStack.pop();
|
||||||
|
|
||||||
|
assertEquals('A', element);
|
||||||
|
assertEquals(0, charStack.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenCharStack_whenElementIsPeeked_thenElementIsNotRemovedAndSizeDoesNotChange() {
|
||||||
|
|
||||||
|
Stack<Character> charStack = new Stack<>();
|
||||||
|
charStack.push('A');
|
||||||
|
|
||||||
|
char element = charStack.peek();
|
||||||
|
|
||||||
|
assertEquals('A', element);
|
||||||
|
assertEquals(1, charStack.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
package com.baeldung.charstack;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
public class CharStackWithArrayUnitTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void whenCharStackIsCreated_thenItHasSize0() {
|
||||||
|
|
||||||
|
CharStackWithArray charStack = new CharStackWithArray();
|
||||||
|
|
||||||
|
assertEquals(0, charStack.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenEmptyCharStack_whenElementIsPushed_thenStackSizeisIncreased() {
|
||||||
|
|
||||||
|
CharStackWithArray charStack = new CharStackWithArray();
|
||||||
|
|
||||||
|
charStack.push('A');
|
||||||
|
|
||||||
|
assertEquals(1, charStack.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenEmptyCharStack_when5ElementIsPushed_thenStackSizeis() {
|
||||||
|
|
||||||
|
CharStackWithArray charStack = new CharStackWithArray();
|
||||||
|
|
||||||
|
charStack.push('A');
|
||||||
|
charStack.push('B');
|
||||||
|
charStack.push('C');
|
||||||
|
charStack.push('D');
|
||||||
|
charStack.push('E');
|
||||||
|
|
||||||
|
assertEquals(5, charStack.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenCharStack_whenElementIsPoppedFromStack_thenElementIsRemovedAndSizeChanges() {
|
||||||
|
|
||||||
|
CharStackWithArray charStack = new CharStackWithArray();
|
||||||
|
charStack.push('A');
|
||||||
|
|
||||||
|
char element = charStack.pop();
|
||||||
|
|
||||||
|
assertEquals('A', element);
|
||||||
|
assertEquals(0, charStack.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenCharStack_whenElementIsPeeked_thenElementIsNotRemovedAndSizeDoesNotChange() {
|
||||||
|
|
||||||
|
CharStackWithArray charStack = new CharStackWithArray();
|
||||||
|
charStack.push('A');
|
||||||
|
|
||||||
|
char element = charStack.peek();
|
||||||
|
|
||||||
|
assertEquals('A', element);
|
||||||
|
assertEquals(1, charStack.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.baeldung.queueinterface;
|
package com.baeldung.queueInterface;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.baeldung.queueinterface;
|
package com.baeldung.queueInterface;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
|
@ -4,8 +4,8 @@
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>core-java-concurrency-advanced</artifactId>
|
<artifactId>core-java-concurrency-advanced</artifactId>
|
||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>core-java-concurrency-advanced</name>
|
<name>core-java-concurrency-advanced</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>core-java-concurrency-basic</artifactId>
|
<artifactId>core-java-concurrency-basic</artifactId>
|
||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>core-java-concurrency-basic</name>
|
<name>core-java-concurrency-basic</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>core-java-concurrency-collections</artifactId>
|
<artifactId>core-java-concurrency-collections</artifactId>
|
||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>core-java-concurrency-collections</name>
|
<name>core-java-concurrency-collections</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
|
|
@ -38,3 +38,5 @@
|
||||||
- [How to Get the File Extension of a File in Java](http://www.baeldung.com/java-file-extension)
|
- [How to Get the File Extension of a File in Java](http://www.baeldung.com/java-file-extension)
|
||||||
- [Getting a File’s Mime Type in Java](http://www.baeldung.com/java-file-mime-type)
|
- [Getting a File’s Mime Type in Java](http://www.baeldung.com/java-file-mime-type)
|
||||||
- [Create a Directory in Java](https://www.baeldung.com/java-create-directory)
|
- [Create a Directory in Java](https://www.baeldung.com/java-create-directory)
|
||||||
|
- [How to Write to a CSV File in Java](https://www.baeldung.com/java-csv)
|
||||||
|
- [List Files in a Directory in Java](https://www.baeldung.com/java-list-directory-files)
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>core-java-io</artifactId>
|
<artifactId>core-java-io</artifactId>
|
||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>core-java-io</name>
|
<name>core-java-io</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>core-java-lang-oop</artifactId>
|
<artifactId>core-java-lang-oop</artifactId>
|
||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>core-java-lang-oop</name>
|
<name>core-java-lang-oop</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
package com.baeldung.markerinterface;
|
||||||
|
|
||||||
|
public interface DeletableShape extends Shape {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.baeldung.markerinterface;
|
||||||
|
|
||||||
|
public class Rectangle implements DeletableShape {
|
||||||
|
|
||||||
|
private double width;
|
||||||
|
private double height;
|
||||||
|
|
||||||
|
public Rectangle(double width, double height) {
|
||||||
|
this.width = width;
|
||||||
|
this.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getArea() {
|
||||||
|
return width * height;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getCircumference() {
|
||||||
|
return 2 * (width + height);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
package com.baeldung.markerinterface;
|
||||||
|
|
||||||
|
public interface Shape {
|
||||||
|
double getArea();
|
||||||
|
double getCircumference();
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.baeldung.markerinterface;
|
||||||
|
|
||||||
|
public class ShapeDao {
|
||||||
|
|
||||||
|
public boolean delete(Object object) {
|
||||||
|
if (!(object instanceof DeletableShape)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Calling the code that deletes the entity from the database
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.baeldung.markerinterface;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
public class MarkerInterfaceUnitTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenDeletableObjectThenTrueReturned() {
|
||||||
|
ShapeDao shapeDao = new ShapeDao();
|
||||||
|
Object rectangle = new Rectangle(2, 3);
|
||||||
|
|
||||||
|
boolean result = shapeDao.delete(rectangle);
|
||||||
|
assertEquals(true, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void givenNonDeletableObjectThenFalseReturned() {
|
||||||
|
ShapeDao shapeDao = new ShapeDao();
|
||||||
|
Object object = new Object();
|
||||||
|
|
||||||
|
boolean result = shapeDao.delete(object);
|
||||||
|
assertEquals(false, result);
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,3 +17,4 @@
|
||||||
- [Java Switch Statement](https://www.baeldung.com/java-switch)
|
- [Java Switch Statement](https://www.baeldung.com/java-switch)
|
||||||
- [The Modulo Operator in Java](https://www.baeldung.com/modulo-java)
|
- [The Modulo Operator in Java](https://www.baeldung.com/modulo-java)
|
||||||
- [Ternary Operator In Java](https://www.baeldung.com/java-ternary-operator)
|
- [Ternary Operator In Java](https://www.baeldung.com/java-ternary-operator)
|
||||||
|
- [Java instanceof Operator](https://www.baeldung.com/java-instanceof)
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>core-java-lang-syntax</artifactId>
|
<artifactId>core-java-lang-syntax</artifactId>
|
||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>core-java-lang-syntax</name>
|
<name>core-java-lang-syntax</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
|
|
@ -35,3 +35,9 @@
|
||||||
- [Retrieving a Class Name in Java](https://www.baeldung.com/java-class-name)
|
- [Retrieving a Class Name in Java](https://www.baeldung.com/java-class-name)
|
||||||
- [Java Compound Operators](https://www.baeldung.com/java-compound-operators)
|
- [Java Compound Operators](https://www.baeldung.com/java-compound-operators)
|
||||||
- [Guide to Java Packages](https://www.baeldung.com/java-packages)
|
- [Guide to Java Packages](https://www.baeldung.com/java-packages)
|
||||||
|
- [The Java Native Keyword and Methods](https://www.baeldung.com/java-native)
|
||||||
|
- [If-Else Statement in Java](https://www.baeldung.com/java-if-else)
|
||||||
|
- [Control Structures in Java](https://www.baeldung.com/java-control-structures)
|
||||||
|
- [Java Interfaces](https://www.baeldung.com/java-interfaces)
|
||||||
|
- [Attaching Values to Java Enum](https://www.baeldung.com/java-enum-values)
|
||||||
|
- [Variable Scope in Java](https://www.baeldung.com/java-variable-scope)
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>core-java-lang</artifactId>
|
<artifactId>core-java-lang</artifactId>
|
||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>core-java-lang</name>
|
<name>core-java-lang</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.baeldung.variable.scope.examples;
|
package com.baeldung.scope;
|
||||||
|
|
||||||
public class BracketScopeExample {
|
public class BracketScopeExample {
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.baeldung.variable.scope.examples;
|
package com.baeldung.scope;
|
||||||
|
|
||||||
public class ClassScopeExample {
|
public class ClassScopeExample {
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.baeldung.variable.scope.examples;
|
package com.baeldung.scope;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.baeldung.variable.scope.examples;
|
package com.baeldung.scope;
|
||||||
|
|
||||||
public class MethodScopeExample {
|
public class MethodScopeExample {
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.baeldung.variable.scope.examples;
|
package com.baeldung.scope;
|
||||||
|
|
||||||
public class NestedScopesExample {
|
public class NestedScopesExample {
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,43 @@
|
||||||
package com.baeldung.java.enumiteration;
|
package com.baeldung.java.enumiteration;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class EnumIterationExamples {
|
public class EnumIterationExamples {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println("Enum iteration using forEach:");
|
System.out.println("Enum iteration using EnumSet:");
|
||||||
EnumSet.allOf(DaysOfWeekEnum.class).forEach(day -> System.out.println(day));
|
EnumSet.allOf(DaysOfWeekEnum.class).forEach(day -> System.out.println(day));
|
||||||
|
|
||||||
System.out.println("Enum iteration using Stream:");
|
System.out.println("Enum iteration using Stream:");
|
||||||
DaysOfWeekEnum.stream().filter(d -> d.getTypeOfDay().equals("off")).forEach(System.out::println);
|
DaysOfWeekEnum.stream().filter(d -> d.getTypeOfDay().equals("off")).forEach(System.out::println);
|
||||||
|
|
||||||
System.out.println("Enum iteration using for loop:");
|
System.out.println("Enum iteration using a for loop:");
|
||||||
for (DaysOfWeekEnum day : DaysOfWeekEnum.values()) {
|
for (DaysOfWeekEnum day : DaysOfWeekEnum.values()) {
|
||||||
System.out.println(day);
|
System.out.println(day);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println("Enum iteration using Arrays.asList():");
|
||||||
|
Arrays.asList(DaysOfWeekEnum.values()).forEach(day -> System.out.println(day));
|
||||||
|
|
||||||
|
System.out.println("Add Enum values to ArrayList:");
|
||||||
|
List<DaysOfWeekEnum> days = new ArrayList<>();
|
||||||
|
days.add(DaysOfWeekEnum.FRIDAY);
|
||||||
|
days.add(DaysOfWeekEnum.SATURDAY);
|
||||||
|
days.add(DaysOfWeekEnum.SUNDAY);
|
||||||
|
for (DaysOfWeekEnum day : days) {
|
||||||
|
System.out.println(day);
|
||||||
|
}
|
||||||
|
System.out.println("Remove SATURDAY from the list:");
|
||||||
|
days.remove(DaysOfWeekEnum.SATURDAY);
|
||||||
|
if (!days.contains(DaysOfWeekEnum.SATURDAY)) {
|
||||||
|
System.out.println("Saturday is no longer in the list");
|
||||||
|
}
|
||||||
|
for (DaysOfWeekEnum day : days) {
|
||||||
|
System.out.println(day);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>core-java-networking</artifactId>
|
<artifactId>core-java-networking</artifactId>
|
||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>core-java-networking</name>
|
<name>core-java-networking</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
|
|
@ -6,3 +6,4 @@
|
||||||
- [Understanding Memory Leaks in Java](https://www.baeldung.com/java-memory-leaks)
|
- [Understanding Memory Leaks in Java](https://www.baeldung.com/java-memory-leaks)
|
||||||
- [OutOfMemoryError: GC Overhead Limit Exceeded](http://www.baeldung.com/java-gc-overhead-limit-exceeded)
|
- [OutOfMemoryError: GC Overhead Limit Exceeded](http://www.baeldung.com/java-gc-overhead-limit-exceeded)
|
||||||
- [Basic Introduction to JMX](http://www.baeldung.com/java-management-extensions)
|
- [Basic Introduction to JMX](http://www.baeldung.com/java-management-extensions)
|
||||||
|
- [Monitoring Java Applications with Flight Recorder](https://www.baeldung.com/java-flight-recorder-monitoring)
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>core-java-perf</artifactId>
|
<artifactId>core-java-perf</artifactId>
|
||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>core-java-perf</name>
|
<name>core-java-perf</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
|
|
@ -9,3 +9,4 @@
|
||||||
- [Hashing a Password in Java](https://www.baeldung.com/java-password-hashing)
|
- [Hashing a Password in Java](https://www.baeldung.com/java-password-hashing)
|
||||||
- [SSL Handshake Failures](https://www.baeldung.com/java-ssl-handshake-failures)
|
- [SSL Handshake Failures](https://www.baeldung.com/java-ssl-handshake-failures)
|
||||||
- [SHA-256 Hashing in Java](https://www.baeldung.com/sha-256-hashing-java)
|
- [SHA-256 Hashing in Java](https://www.baeldung.com/sha-256-hashing-java)
|
||||||
|
- [Enabling TLS v1.2 in Java 7](https://www.baeldung.com/java-7-tls-v12)
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>core-java-security</artifactId>
|
<artifactId>core-java-security</artifactId>
|
||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>core-java-security</name>
|
<name>core-java-security</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>core-java-sun</artifactId>
|
<artifactId>core-java-sun</artifactId>
|
||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>core-java-sun</name>
|
<name>core-java-sun</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
|
|
@ -47,3 +47,7 @@
|
||||||
- [Console I/O in Java](http://www.baeldung.com/java-console-input-output)
|
- [Console I/O in Java](http://www.baeldung.com/java-console-input-output)
|
||||||
- [Formatting with printf() in Java](https://www.baeldung.com/java-printstream-printf)
|
- [Formatting with printf() in Java](https://www.baeldung.com/java-printstream-printf)
|
||||||
- [Retrieve Fields from a Java Class Using Reflection](https://www.baeldung.com/java-reflection-class-fields)
|
- [Retrieve Fields from a Java Class Using Reflection](https://www.baeldung.com/java-reflection-class-fields)
|
||||||
|
- [Introduction to Basic Syntax in Java](https://www.baeldung.com/java-syntax)
|
||||||
|
- [Using Curl in Java](https://www.baeldung.com/java-curl)
|
||||||
|
- [Finding Leap Years in Java](https://www.baeldung.com/java-leap-year)
|
||||||
|
- [Java Bitwise Operators](https://www.baeldung.com/java-bitwise-operators)
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.baeldung.jar;
|
||||||
|
|
||||||
|
public class JarExample {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println("Hello Baeldung Reader!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
Main-Class: com.baeldung.jar.JarExample
|
|
@ -51,3 +51,4 @@
|
||||||
- [Operator Overloading in Kotlin](https://www.baeldung.com/kotlin-operator-overloading)
|
- [Operator Overloading in Kotlin](https://www.baeldung.com/kotlin-operator-overloading)
|
||||||
- [Inline Classes in Kotlin](https://www.baeldung.com/kotlin-inline-classes)
|
- [Inline Classes in Kotlin](https://www.baeldung.com/kotlin-inline-classes)
|
||||||
- [Creating Java static final Equivalents in Kotlin](https://www.baeldung.com/kotlin-java-static-final)
|
- [Creating Java static final Equivalents in Kotlin](https://www.baeldung.com/kotlin-java-static-final)
|
||||||
|
- [Nested forEach in Kotlin](https://www.baeldung.com/kotlin-nested-foreach)
|
||||||
|
|
|
@ -64,13 +64,13 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>nl.komponents.kovenant</groupId>
|
<groupId>nl.komponents.kovenant</groupId>
|
||||||
<artifactId>kovenant</artifactId>
|
<artifactId>kovenant</artifactId>
|
||||||
<version>3.3.0</version>
|
<version>${kovenant.version}</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>uy.kohesive.injekt</groupId>
|
<groupId>uy.kohesive.injekt</groupId>
|
||||||
<artifactId>injekt-core</artifactId>
|
<artifactId>injekt-core</artifactId>
|
||||||
<version>1.16.1</version>
|
<version>${injekt-core.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -82,6 +82,8 @@
|
||||||
<assertj.version>3.10.0</assertj.version>
|
<assertj.version>3.10.0</assertj.version>
|
||||||
<h2database.version>1.4.197</h2database.version>
|
<h2database.version>1.4.197</h2database.version>
|
||||||
<fuel.version>1.15.0</fuel.version>
|
<fuel.version>1.15.0</fuel.version>
|
||||||
|
<kovenant.version>3.3.0</kovenant.version>
|
||||||
|
<injekt-core.version>1.16.1</injekt-core.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -7,12 +7,12 @@ class CalculatorTest5 {
|
||||||
private val calculator = Calculator()
|
private val calculator = Calculator()
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun whenAdding1and3_thenAnswerIs4() {
|
fun `Adding 1 and 3 should be equal to 4`() {
|
||||||
Assertions.assertEquals(4, calculator.add(1, 3))
|
Assertions.assertEquals(4, calculator.add(1, 3))
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun whenDividingBy0_thenErrorOccurs() {
|
fun `Dividing by zero should throw the DivideByZeroException`() {
|
||||||
val exception = Assertions.assertThrows(DivideByZeroException::class.java) {
|
val exception = Assertions.assertThrows(DivideByZeroException::class.java) {
|
||||||
calculator.divide(5, 0)
|
calculator.divide(5, 0)
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ class CalculatorTest5 {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun whenSquaringNumbers_thenCorrectAnswerGiven() {
|
fun `The square of a number should be equal to that number multiplied in itself`() {
|
||||||
Assertions.assertAll(
|
Assertions.assertAll(
|
||||||
Executable { Assertions.assertEquals(1, calculator.square(1)) },
|
Executable { Assertions.assertEquals(1, calculator.square(1)) },
|
||||||
Executable { Assertions.assertEquals(4, calculator.square(2)) },
|
Executable { Assertions.assertEquals(4, calculator.square(2)) },
|
||||||
|
@ -76,7 +76,7 @@ class CalculatorTest5 {
|
||||||
Tag("logarithms")
|
Tag("logarithms")
|
||||||
)
|
)
|
||||||
@Test
|
@Test
|
||||||
fun whenIcalculateLog2Of8_thenIget3() {
|
fun `Log to base 2 of 8 should be equal to 3`() {
|
||||||
Assertions.assertEquals(3.0, calculator.log(2, 8))
|
Assertions.assertEquals(3.0, calculator.log(2, 8))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,15 +5,16 @@ import org.junit.jupiter.api.Disabled
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class SimpleTest5 {
|
class SimpleTest5 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun whenEmptyList_thenListIsEmpty() {
|
fun `isEmpty should return true for empty lists`() {
|
||||||
val list = listOf<String>()
|
val list = listOf<String>()
|
||||||
Assertions.assertTrue(list::isEmpty)
|
Assertions.assertTrue(list::isEmpty)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Disabled
|
@Disabled
|
||||||
fun when3equals4_thenTestFails() {
|
fun `3 is equal to 4`() {
|
||||||
Assertions.assertEquals(3, 4) {
|
Assertions.assertEquals(3, 4) {
|
||||||
"Three does not equal four"
|
"Three does not equal four"
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>couchbase</artifactId>
|
<artifactId>couchbase</artifactId>
|
||||||
<version>0.1-SNAPSHOT</version>
|
<version>0.1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>couchbase</name>
|
<name>couchbase</name>
|
||||||
<description>Couchbase Tutorials</description>
|
<description>Couchbase Tutorials</description>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
<groupId>org.baeldung.pmd</groupId>
|
<groupId>org.baeldung.pmd</groupId>
|
||||||
<artifactId>custom-pmd</artifactId>
|
<artifactId>custom-pmd</artifactId>
|
||||||
<version>0.0.1</version>
|
<version>0.0.1</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>custom-pmd</name>
|
<name>custom-pmd</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
<url>http://maven.apache.org</url>
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
24
ddd/pom.xml
24
ddd/pom.xml
|
@ -1,6 +1,12 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>com.baeldung.ddd</groupId>
|
||||||
|
<artifactId>ddd</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<name>ddd</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<description>DDD series examples</description>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
@ -9,18 +15,6 @@
|
||||||
<relativePath /> <!-- lookup parent from repository -->
|
<relativePath /> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<groupId>com.baeldung.ddd</groupId>
|
|
||||||
<artifactId>ddd</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>ddd</name>
|
|
||||||
<description>DDD series examples</description>
|
|
||||||
|
|
||||||
<properties>
|
|
||||||
<joda-money.version>1.0.1</joda-money.version>
|
|
||||||
<maven-surefire-plugin.version>2.22.0</maven-surefire-plugin.version>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
@ -88,4 +82,10 @@
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<joda-money.version>1.0.1</joda-money.version>
|
||||||
|
<maven-surefire-plugin.version>2.22.0</maven-surefire-plugin.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -3,9 +3,9 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.baeldung.deeplearning4j</groupId>
|
<groupId>com.baeldung.deeplearning4j</groupId>
|
||||||
<artifactId>deeplearning4j</artifactId>
|
<artifactId>deeplearning4j</artifactId>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<name>deeplearning4j</name>
|
<name>deeplearning4j</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>disruptor</artifactId>
|
<artifactId>disruptor</artifactId>
|
||||||
<version>0.1.0-SNAPSHOT</version>
|
<version>0.1.0-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>disruptor</name>
|
<name>disruptor</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
|
|
@ -8,44 +8,49 @@
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<name>flyway-cdi-extension</name>
|
<name>flyway-cdi-extension</name>
|
||||||
|
|
||||||
<properties>
|
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.enterprise</groupId>
|
<groupId>javax.enterprise</groupId>
|
||||||
<artifactId>cdi-api</artifactId>
|
<artifactId>cdi-api</artifactId>
|
||||||
<version>2.0.SP1</version>
|
<version>${cdi-api.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jboss.weld.se</groupId>
|
<groupId>org.jboss.weld.se</groupId>
|
||||||
<artifactId>weld-se-core</artifactId>
|
<artifactId>weld-se-core</artifactId>
|
||||||
<version>3.0.5.Final</version>
|
<version>${weld-se-core.version}</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.flywaydb</groupId>
|
<groupId>org.flywaydb</groupId>
|
||||||
<artifactId>flyway-core</artifactId>
|
<artifactId>flyway-core</artifactId>
|
||||||
<version>5.1.4</version>
|
<version>${flyway-core.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.tomcat</groupId>
|
<groupId>org.apache.tomcat</groupId>
|
||||||
<artifactId>tomcat-jdbc</artifactId>
|
<artifactId>tomcat-jdbc</artifactId>
|
||||||
<version>8.5.33</version>
|
<version>${tomcat-jdbc.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.annotation</groupId>
|
<groupId>javax.annotation</groupId>
|
||||||
<artifactId>javax.annotation-api</artifactId>
|
<artifactId>javax.annotation-api</artifactId>
|
||||||
<version>1.3.2</version>
|
<version>${javax.annotation-api.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.h2database</groupId>
|
<groupId>com.h2database</groupId>
|
||||||
<artifactId>h2</artifactId>
|
<artifactId>h2</artifactId>
|
||||||
<version>1.4.197</version>
|
<version>${h2.version}</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
|
<cdi-api.version>2.0.SP1</cdi-api.version>
|
||||||
|
<weld-se-core.version>3.0.5.Final</weld-se-core.version>
|
||||||
|
<flyway-core.version>5.1.4</flyway-core.version>
|
||||||
|
<tomcat-jdbc.version>8.5.33</tomcat-jdbc.version>
|
||||||
|
<javax.annotation-api.version>1.3.2</javax.annotation-api.version>
|
||||||
|
<h2.version>1.4.197</h2.version>
|
||||||
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>geotools</artifactId>
|
<artifactId>geotools</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>geotools</name>
|
<name>geotools</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
<url>http://maven.apache.org</url>
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>google-cloud</artifactId>
|
<artifactId>google-cloud</artifactId>
|
||||||
<version>0.1-SNAPSHOT</version>
|
<version>0.1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>google-cloud</name>
|
<name>google-cloud</name>
|
||||||
<description>Google Cloud Tutorials</description>
|
<description>Google Cloud Tutorials</description>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>google-web-toolkit</artifactId>
|
<artifactId>google-web-toolkit</artifactId>
|
||||||
<packaging>war</packaging>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<name>google-web-toolkit</name>
|
<name>google-web-toolkit</name>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.gwt</groupId>
|
<groupId>com.google.gwt</groupId>
|
||||||
<artifactId>gwt</artifactId>
|
<artifactId>gwt</artifactId>
|
||||||
<version>2.8.2</version>
|
<version>${gwt.version}</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>4.11</version>
|
<version>${junit.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
@ -120,6 +120,8 @@
|
||||||
<!-- Don't let your Mac use a crazy non-standard encoding -->
|
<!-- Don't let your Mac use a crazy non-standard encoding -->
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
<junit.version>4.11</junit.version>
|
||||||
|
<gwt.version>2.8.2</gwt.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>grpc</artifactId>
|
<artifactId>grpc</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>grpc</name>
|
<name>grpc</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.baeldung.examples.guice</groupId>
|
<groupId>com.baeldung.examples.guice</groupId>
|
||||||
<artifactId>guice</artifactId>
|
<artifactId>guice</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>guice</name>
|
<name>guice</name>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
|
@ -21,25 +20,10 @@
|
||||||
<artifactId>guice</artifactId>
|
<artifactId>guice</artifactId>
|
||||||
<version>${guice.version}</version>
|
<version>${guice.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework</groupId>
|
|
||||||
<artifactId>spring-context</artifactId>
|
|
||||||
<version>${spring.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework</groupId>
|
|
||||||
<artifactId>spring-test</artifactId>
|
|
||||||
<version>${springtest.version}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<guice.version>4.2.2</guice.version>
|
<guice.version>4.1.0</guice.version>
|
||||||
<spring.version>5.1.3.RELEASE</spring.version>
|
|
||||||
<springtest.version>5.1.3.RELEASE</springtest.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue