Merge remote-tracking branch 'eugenp/master'
This commit is contained in:
		
						commit
						6a4b0f51b2
					
				| @ -4,4 +4,4 @@ | |||||||
| - [Merge Sort in Java](https://www.baeldung.com/java-merge-sort) | - [Merge Sort in Java](https://www.baeldung.com/java-merge-sort) | ||||||
| - [Quicksort Algorithm Implementation in Java](https://www.baeldung.com/java-quicksort) | - [Quicksort Algorithm Implementation in Java](https://www.baeldung.com/java-quicksort) | ||||||
| - [Insertion Sort in Java](https://www.baeldung.com/java-insertion-sort) | - [Insertion Sort in Java](https://www.baeldung.com/java-insertion-sort) | ||||||
| 
 | - [Heap Sort in Java](https://www.baeldung.com/java-heap-sort) | ||||||
|  | |||||||
							
								
								
									
										3
									
								
								apache-pulsar/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								apache-pulsar/README.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,3 @@ | |||||||
|  | ### Relevant Articles:  | ||||||
|  | 
 | ||||||
|  | - [Introduction to Apache Pulsar](https://www.baeldung.com/apache-pulsar) | ||||||
							
								
								
									
										25
									
								
								core-java-arrays/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								core-java-arrays/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,25 @@ | |||||||
|  | *.class | ||||||
|  | 
 | ||||||
|  | 0.* | ||||||
|  | 
 | ||||||
|  | #folders# | ||||||
|  | /target | ||||||
|  | /neoDb* | ||||||
|  | /data | ||||||
|  | /src/main/webapp/WEB-INF/classes | ||||||
|  | */META-INF/* | ||||||
|  | .resourceCache | ||||||
|  | 
 | ||||||
|  | # Packaged files # | ||||||
|  | *.jar | ||||||
|  | *.war | ||||||
|  | *.ear | ||||||
|  | 
 | ||||||
|  | # Files generated by integration tests | ||||||
|  | backup-pom.xml | ||||||
|  | /bin/ | ||||||
|  | /temp | ||||||
|  | 
 | ||||||
|  | #IntelliJ specific | ||||||
|  | .idea/ | ||||||
|  | *.iml | ||||||
							
								
								
									
										15
									
								
								core-java-arrays/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								core-java-arrays/README.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,15 @@ | |||||||
|  | ========= | ||||||
|  | 
 | ||||||
|  | ## Core Java Arrays Cookbooks and Examples | ||||||
|  | 
 | ||||||
|  | ### Relevant Articles:  | ||||||
|  | - [How to Copy an Array in Java](http://www.baeldung.com/java-array-copy) | ||||||
|  | - [Check if a Java Array Contains a Value](http://www.baeldung.com/java-array-contains-value) | ||||||
|  | - [Initializing Arrays in Java](http://www.baeldung.com/java-initialize-array) | ||||||
|  | - [Guide to the java.util.Arrays Class](http://www.baeldung.com/java-util-arrays) | ||||||
|  | - [Jagged Arrays In Java](http://www.baeldung.com/java-jagged-arrays) | ||||||
|  | - [Find Sum and Average in a Java Array](http://www.baeldung.com/java-array-sum-average) | ||||||
|  | - [Arrays in Java: A Reference Guide](https://www.baeldung.com/java-arrays-guide) | ||||||
|  | - [How to Invert an Array in Java](http://www.baeldung.com/java-invert-array) | ||||||
|  | - [Array Operations in Java](http://www.baeldung.com/java-common-array-operations) | ||||||
|  | 
 | ||||||
							
								
								
									
										412
									
								
								core-java-arrays/pom.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										412
									
								
								core-java-arrays/pom.xml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,412 @@ | |||||||
|  | <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"> | ||||||
|  |     <modelVersion>4.0.0</modelVersion> | ||||||
|  |     <groupId>com.baeldung</groupId> | ||||||
|  |     <artifactId>core-java-arrays</artifactId> | ||||||
|  |     <version>0.1.0-SNAPSHOT</version> | ||||||
|  |     <packaging>jar</packaging> | ||||||
|  |     <name>core-java-arrays</name> | ||||||
|  | 
 | ||||||
|  |     <parent> | ||||||
|  |         <groupId>com.baeldung</groupId> | ||||||
|  |         <artifactId>parent-java</artifactId> | ||||||
|  |         <version>0.0.1-SNAPSHOT</version> | ||||||
|  |         <relativePath>../parent-java</relativePath> | ||||||
|  |     </parent> | ||||||
|  | 
 | ||||||
|  |     <dependencies> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.apache.commons</groupId> | ||||||
|  |             <artifactId>commons-lang3</artifactId> | ||||||
|  |             <version>${commons-lang3.version}</version> | ||||||
|  |         </dependency> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>log4j</groupId> | ||||||
|  |             <artifactId>log4j</artifactId> | ||||||
|  |             <version>${log4j.version}</version> | ||||||
|  |         </dependency> | ||||||
|  |         <dependency> <!-- needed to bridge to slf4j for projects that use the log4j APIs directly --> | ||||||
|  |             <groupId>org.slf4j</groupId> | ||||||
|  |             <artifactId>log4j-over-slf4j</artifactId> | ||||||
|  |             <version>${org.slf4j.version}</version> | ||||||
|  |         </dependency> | ||||||
|  |         <!-- test scoped --> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.assertj</groupId> | ||||||
|  |             <artifactId>assertj-core</artifactId> | ||||||
|  |             <version>${assertj-core.version}</version> | ||||||
|  |             <scope>test</scope> | ||||||
|  |         </dependency> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.openjdk.jmh</groupId> | ||||||
|  |             <artifactId>jmh-core</artifactId> | ||||||
|  |             <version>${jmh-core.version}</version> | ||||||
|  |         </dependency> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.openjdk.jmh</groupId> | ||||||
|  |             <artifactId>jmh-generator-annprocess</artifactId> | ||||||
|  |             <version>${jmh-generator-annprocess.version}</version> | ||||||
|  |         </dependency> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.springframework</groupId> | ||||||
|  |             <artifactId>spring-web</artifactId> | ||||||
|  |             <version>${springframework.spring-web.version}</version> | ||||||
|  |         </dependency> | ||||||
|  |     </dependencies> | ||||||
|  | 
 | ||||||
|  |     <build> | ||||||
|  |         <finalName>core-java-arrays</finalName> | ||||||
|  |         <resources> | ||||||
|  |             <resource> | ||||||
|  |                 <directory>src/main/resources</directory> | ||||||
|  |                 <filtering>true</filtering> | ||||||
|  |             </resource> | ||||||
|  |         </resources> | ||||||
|  | 
 | ||||||
|  |         <plugins> | ||||||
|  |             <plugin> | ||||||
|  |                 <groupId>org.apache.maven.plugins</groupId> | ||||||
|  |                 <artifactId>maven-surefire-plugin</artifactId> | ||||||
|  |                 <configuration> | ||||||
|  |                     <excludes> | ||||||
|  |                         <exclude>**/*LiveTest.java</exclude> | ||||||
|  |                         <exclude>**/*IntegrationTest.java</exclude> | ||||||
|  |                         <exclude>**/*IntTest.java</exclude> | ||||||
|  |                         <exclude>**/*LongRunningUnitTest.java</exclude> | ||||||
|  |                         <exclude>**/*ManualTest.java</exclude> | ||||||
|  |                     </excludes> | ||||||
|  |                     <testFailureIgnore>true</testFailureIgnore> | ||||||
|  |                 </configuration> | ||||||
|  |             </plugin> | ||||||
|  | 
 | ||||||
|  |             <plugin> | ||||||
|  |                 <groupId>org.apache.maven.plugins</groupId> | ||||||
|  |                 <artifactId>maven-dependency-plugin</artifactId> | ||||||
|  |                 <executions> | ||||||
|  |                     <execution> | ||||||
|  |                         <id>copy-dependencies</id> | ||||||
|  |                         <phase>prepare-package</phase> | ||||||
|  |                         <goals> | ||||||
|  |                             <goal>copy-dependencies</goal> | ||||||
|  |                         </goals> | ||||||
|  |                         <configuration> | ||||||
|  |                             <outputDirectory>${project.build.directory}/libs</outputDirectory> | ||||||
|  |                         </configuration> | ||||||
|  |                     </execution> | ||||||
|  |                 </executions> | ||||||
|  |             </plugin> | ||||||
|  | 
 | ||||||
|  |             <plugin> | ||||||
|  |                 <groupId>org.apache.maven.plugins</groupId> | ||||||
|  |                 <artifactId>maven-jar-plugin</artifactId> | ||||||
|  |                 <version>${maven-jar-plugin.version}</version> | ||||||
|  |                 <configuration> | ||||||
|  |                     <archive> | ||||||
|  |                         <manifest> | ||||||
|  |                             <addClasspath>true</addClasspath> | ||||||
|  |                             <classpathPrefix>libs/</classpathPrefix> | ||||||
|  |                             <mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass> | ||||||
|  |                         </manifest> | ||||||
|  |                     </archive> | ||||||
|  |                 </configuration> | ||||||
|  |             </plugin> | ||||||
|  | 
 | ||||||
|  |             <plugin> | ||||||
|  |                 <groupId>org.apache.maven.plugins</groupId> | ||||||
|  |                 <artifactId>maven-assembly-plugin</artifactId> | ||||||
|  |                 <executions> | ||||||
|  |                     <execution> | ||||||
|  |                         <phase>package</phase> | ||||||
|  |                         <goals> | ||||||
|  |                             <goal>single</goal> | ||||||
|  |                         </goals> | ||||||
|  |                         <configuration> | ||||||
|  |                             <archiveBaseDirectory>${project.basedir}</archiveBaseDirectory> | ||||||
|  |                             <archive> | ||||||
|  |                                 <manifest> | ||||||
|  |                                     <mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass> | ||||||
|  |                                 </manifest> | ||||||
|  |                             </archive> | ||||||
|  |                             <descriptorRefs> | ||||||
|  |                                 <descriptorRef>jar-with-dependencies</descriptorRef> | ||||||
|  |                             </descriptorRefs> | ||||||
|  |                         </configuration> | ||||||
|  |                     </execution> | ||||||
|  |                 </executions> | ||||||
|  |             </plugin> | ||||||
|  | 
 | ||||||
|  |             <plugin> | ||||||
|  |                 <groupId>org.apache.maven.plugins</groupId> | ||||||
|  |                 <artifactId>maven-shade-plugin</artifactId> | ||||||
|  |                 <version>${maven-shade-plugin.version}</version> | ||||||
|  |                 <executions> | ||||||
|  |                     <execution> | ||||||
|  |                         <goals> | ||||||
|  |                             <goal>shade</goal> | ||||||
|  |                         </goals> | ||||||
|  |                         <configuration> | ||||||
|  |                             <shadedArtifactAttached>true</shadedArtifactAttached> | ||||||
|  |                             <transformers> | ||||||
|  |                                 <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> | ||||||
|  |                                     <mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass> | ||||||
|  |                                 </transformer> | ||||||
|  |                             </transformers> | ||||||
|  |                         </configuration> | ||||||
|  |                     </execution> | ||||||
|  |                 </executions> | ||||||
|  |             </plugin> | ||||||
|  | 
 | ||||||
|  |             <plugin> | ||||||
|  |                 <groupId>com.jolira</groupId> | ||||||
|  |                 <artifactId>onejar-maven-plugin</artifactId> | ||||||
|  |                 <version>${onejar-maven-plugin.version}</version> | ||||||
|  |                 <executions> | ||||||
|  |                     <execution> | ||||||
|  |                         <configuration> | ||||||
|  |                             <mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass> | ||||||
|  |                             <attachToBuild>true</attachToBuild> | ||||||
|  |                             <filename>${project.build.finalName}-onejar.${project.packaging}</filename> | ||||||
|  |                         </configuration> | ||||||
|  |                         <goals> | ||||||
|  |                             <goal>one-jar</goal> | ||||||
|  |                         </goals> | ||||||
|  |                     </execution> | ||||||
|  |                 </executions> | ||||||
|  |             </plugin> | ||||||
|  | 
 | ||||||
|  |             <plugin> | ||||||
|  |                 <groupId>org.springframework.boot</groupId> | ||||||
|  |                 <artifactId>spring-boot-maven-plugin</artifactId> | ||||||
|  |                 <version>${spring-boot-maven-plugin.version}</version> | ||||||
|  |                 <executions> | ||||||
|  |                     <execution> | ||||||
|  |                         <goals> | ||||||
|  |                             <goal>repackage</goal> | ||||||
|  |                         </goals> | ||||||
|  |                         <configuration> | ||||||
|  |                             <classifier>spring-boot</classifier> | ||||||
|  |                             <mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass> | ||||||
|  |                         </configuration> | ||||||
|  |                     </execution> | ||||||
|  |                 </executions> | ||||||
|  |             </plugin> | ||||||
|  | 
 | ||||||
|  |             <plugin> | ||||||
|  |                 <groupId>org.codehaus.mojo</groupId> | ||||||
|  |                 <artifactId>exec-maven-plugin</artifactId> | ||||||
|  |                 <version>${exec-maven-plugin.version}</version> | ||||||
|  |                 <configuration> | ||||||
|  |                     <executable>java</executable> | ||||||
|  |                     <mainClass>com.baeldung.outofmemoryerror.OutOfMemoryGCLimitExceed</mainClass> | ||||||
|  |                     <arguments> | ||||||
|  |                         <argument>-Xmx300m</argument> | ||||||
|  |                         <argument>-XX:+UseParallelGC</argument> | ||||||
|  |                         <argument>-classpath</argument> | ||||||
|  |                         <classpath /> | ||||||
|  |                         <argument>com.baeldung.outofmemoryerror.OutOfMemoryGCLimitExceed</argument> | ||||||
|  |                     </arguments> | ||||||
|  |                 </configuration> | ||||||
|  |             </plugin> | ||||||
|  |              | ||||||
|  |             <plugin> | ||||||
|  |                 <groupId>org.apache.maven.plugins</groupId> | ||||||
|  |                 <artifactId>maven-javadoc-plugin</artifactId> | ||||||
|  |                 <version>${maven-javadoc-plugin.version}</version> | ||||||
|  |                 <configuration> | ||||||
|  |                     <source>1.8</source> | ||||||
|  |                     <target>1.8</target> | ||||||
|  |                 </configuration> | ||||||
|  |             </plugin> | ||||||
|  |         </plugins> | ||||||
|  |     </build> | ||||||
|  | 
 | ||||||
|  |     <profiles> | ||||||
|  |         <profile> | ||||||
|  |             <id>integration</id> | ||||||
|  |             <build> | ||||||
|  |                 <plugins> | ||||||
|  |                     <plugin> | ||||||
|  |                         <groupId>org.apache.maven.plugins</groupId> | ||||||
|  |                         <artifactId>maven-surefire-plugin</artifactId> | ||||||
|  |                         <executions> | ||||||
|  |                             <execution> | ||||||
|  |                                 <phase>integration-test</phase> | ||||||
|  |                                 <goals> | ||||||
|  |                                     <goal>test</goal> | ||||||
|  |                                 </goals> | ||||||
|  |                                 <configuration> | ||||||
|  |                                     <excludes> | ||||||
|  |                                         <exclude>**/*ManualTest.java</exclude> | ||||||
|  |                                     </excludes> | ||||||
|  |                                     <includes> | ||||||
|  |                                         <include>**/*IntegrationTest.java</include> | ||||||
|  |                                         <include>**/*IntTest.java</include> | ||||||
|  |                                     </includes> | ||||||
|  |                                 </configuration> | ||||||
|  |                             </execution> | ||||||
|  |                         </executions> | ||||||
|  |                         <configuration> | ||||||
|  |                             <systemPropertyVariables> | ||||||
|  |                                 <test.mime>json</test.mime> | ||||||
|  |                             </systemPropertyVariables> | ||||||
|  |                         </configuration> | ||||||
|  |                     </plugin> | ||||||
|  |                     <plugin> | ||||||
|  |                         <groupId>org.codehaus.mojo</groupId> | ||||||
|  |                         <artifactId>exec-maven-plugin</artifactId> | ||||||
|  |                         <version>${exec-maven-plugin.version}</version> | ||||||
|  |                         <executions> | ||||||
|  |                             <execution> | ||||||
|  |                                 <id>run-benchmarks</id> | ||||||
|  |                                 <!-- <phase>integration-test</phase> --> | ||||||
|  |                                 <phase>none</phase> | ||||||
|  |                                 <goals> | ||||||
|  |                                     <goal>exec</goal> | ||||||
|  |                                 </goals> | ||||||
|  |                                 <configuration> | ||||||
|  |                                     <classpathScope>test</classpathScope> | ||||||
|  |                                     <executable>java</executable> | ||||||
|  |                                     <arguments> | ||||||
|  |                                         <argument>-classpath</argument> | ||||||
|  |                                         <classpath /> | ||||||
|  |                                         <argument>org.openjdk.jmh.Main</argument> | ||||||
|  |                                         <argument>.*</argument> | ||||||
|  |                                     </arguments> | ||||||
|  |                                 </configuration> | ||||||
|  |                             </execution> | ||||||
|  |                         </executions> | ||||||
|  |                     </plugin> | ||||||
|  |                 </plugins> | ||||||
|  |             </build> | ||||||
|  |         </profile> | ||||||
|  | 
 | ||||||
|  |         <!-- java instrumentation profiles to build jars --> | ||||||
|  |         <profile> | ||||||
|  |             <id>buildAgentLoader</id> | ||||||
|  |             <build> | ||||||
|  |                 <plugins> | ||||||
|  |                     <plugin> | ||||||
|  |                         <groupId>org.apache.maven.plugins</groupId> | ||||||
|  |                         <artifactId>maven-jar-plugin</artifactId> | ||||||
|  |                         <executions> | ||||||
|  |                             <execution> | ||||||
|  |                                 <phase>package</phase> | ||||||
|  |                                 <goals> | ||||||
|  |                                     <goal>jar</goal> | ||||||
|  |                                 </goals> | ||||||
|  |                                 <configuration> | ||||||
|  |                                     <classifier>agentLoader</classifier> | ||||||
|  |                                     <classesDirectory>target/classes</classesDirectory> | ||||||
|  |                                     <archive> | ||||||
|  |                                         <manifest> | ||||||
|  |                                             <addClasspath>true</addClasspath> | ||||||
|  |                                         </manifest> | ||||||
|  |                                         <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> | ||||||
|  |                                     </archive> | ||||||
|  | 
 | ||||||
|  |                                     <includes> | ||||||
|  |                                         <include>com/baeldung/instrumentation/application/AgentLoader.class</include> | ||||||
|  |                                         <include>com/baeldung/instrumentation/application/Launcher.class</include> | ||||||
|  |                                     </includes> | ||||||
|  |                                 </configuration> | ||||||
|  |                             </execution> | ||||||
|  |                         </executions> | ||||||
|  |                     </plugin> | ||||||
|  |                 </plugins> | ||||||
|  |             </build> | ||||||
|  |         </profile> | ||||||
|  |         <profile> | ||||||
|  |             <id>buildApplication</id> | ||||||
|  |             <build> | ||||||
|  |                 <plugins> | ||||||
|  |                     <plugin> | ||||||
|  |                         <groupId>org.apache.maven.plugins</groupId> | ||||||
|  |                         <artifactId>maven-jar-plugin</artifactId> | ||||||
|  |                         <executions> | ||||||
|  |                             <execution> | ||||||
|  |                                 <phase>package</phase> | ||||||
|  |                                 <goals> | ||||||
|  |                                     <goal>jar</goal> | ||||||
|  |                                 </goals> | ||||||
|  |                                 <configuration> | ||||||
|  |                                     <classifier>application</classifier> | ||||||
|  |                                     <classesDirectory>target/classes</classesDirectory> | ||||||
|  |                                     <archive> | ||||||
|  |                                         <manifest> | ||||||
|  |                                             <addClasspath>true</addClasspath> | ||||||
|  |                                         </manifest> | ||||||
|  |                                         <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> | ||||||
|  |                                     </archive> | ||||||
|  | 
 | ||||||
|  |                                     <includes> | ||||||
|  |                                         <include>com/baeldung/instrumentation/application/MyAtm.class</include> | ||||||
|  |                                         <include>com/baeldung/instrumentation/application/MyAtmApplication.class</include> | ||||||
|  |                                         <include>com/baeldung/instrumentation/application/Launcher.class</include> | ||||||
|  |                                     </includes> | ||||||
|  |                                 </configuration> | ||||||
|  |                             </execution> | ||||||
|  |                         </executions> | ||||||
|  |                     </plugin> | ||||||
|  |                 </plugins> | ||||||
|  |             </build> | ||||||
|  |         </profile> | ||||||
|  |         <profile> | ||||||
|  |             <id>buildAgent</id> | ||||||
|  |             <build> | ||||||
|  |                 <plugins> | ||||||
|  |                     <plugin> | ||||||
|  |                         <groupId>org.apache.maven.plugins</groupId> | ||||||
|  |                         <artifactId>maven-jar-plugin</artifactId> | ||||||
|  |                         <executions> | ||||||
|  |                             <execution> | ||||||
|  |                                 <phase>package</phase> | ||||||
|  |                                 <goals> | ||||||
|  |                                     <goal>jar</goal> | ||||||
|  |                                 </goals> | ||||||
|  |                                 <configuration> | ||||||
|  |                                     <classifier>agent</classifier> | ||||||
|  |                                     <classesDirectory>target/classes</classesDirectory> | ||||||
|  |                                     <archive> | ||||||
|  |                                         <manifest> | ||||||
|  |                                             <addClasspath>true</addClasspath> | ||||||
|  |                                         </manifest> | ||||||
|  |                                         <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> | ||||||
|  |                                     </archive> | ||||||
|  | 
 | ||||||
|  |                                     <includes> | ||||||
|  |                                         <include>com/baeldung/instrumentation/agent/AtmTransformer.class</include> | ||||||
|  |                                         <include>com/baeldung/instrumentation/agent/MyInstrumentationAgent.class</include> | ||||||
|  |                                     </includes> | ||||||
|  |                                 </configuration> | ||||||
|  |                             </execution> | ||||||
|  |                         </executions> | ||||||
|  |                     </plugin> | ||||||
|  |                 </plugins> | ||||||
|  |             </build> | ||||||
|  |         </profile> | ||||||
|  |     </profiles> | ||||||
|  | 
 | ||||||
|  |     <properties> | ||||||
|  | 
 | ||||||
|  |         <!-- util --> | ||||||
|  |         <commons-lang3.version>3.8.1</commons-lang3.version> | ||||||
|  |         <lombok.version>1.16.12</lombok.version> | ||||||
|  |          | ||||||
|  |         <jmh-core.version>1.19</jmh-core.version> | ||||||
|  |         <jmh-generator-annprocess.version>1.19</jmh-generator-annprocess.version> | ||||||
|  | 
 | ||||||
|  |         <!-- testing --> | ||||||
|  |         <assertj-core.version>3.10.0</assertj-core.version> | ||||||
|  | 
 | ||||||
|  |         <!-- maven and spring plugins --> | ||||||
|  |         <maven-surefire-plugin.version>2.21.0</maven-surefire-plugin.version> | ||||||
|  |         <springframework.spring-web.version>4.3.4.RELEASE</springframework.spring-web.version> | ||||||
|  |         <maven-javadoc-plugin.version>3.0.0-M1</maven-javadoc-plugin.version> | ||||||
|  |         <maven-jar-plugin.version>3.0.2</maven-jar-plugin.version> | ||||||
|  |         <onejar-maven-plugin.version>1.4.4</onejar-maven-plugin.version> | ||||||
|  |         <maven-shade-plugin.version>3.1.1</maven-shade-plugin.version> | ||||||
|  |         <spring-boot-maven-plugin.version>2.0.3.RELEASE</spring-boot-maven-plugin.version> | ||||||
|  |         <exec-maven-plugin.version>1.6.0</exec-maven-plugin.version> | ||||||
|  |     </properties> | ||||||
|  | 
 | ||||||
|  | </project> | ||||||
| @ -2,7 +2,7 @@ package com.baeldung.array; | |||||||
| 
 | 
 | ||||||
| import java.util.Arrays; | import java.util.Arrays; | ||||||
| 
 | 
 | ||||||
| import org.apache.commons.lang.ArrayUtils; | import org.apache.commons.lang3.ArrayUtils; | ||||||
| 
 | 
 | ||||||
| public class ArrayInitializer { | public class ArrayInitializer { | ||||||
| 
 | 
 | ||||||
| @ -39,3 +39,14 @@ | |||||||
| - [Operating on and Removing an Item from Stream](https://www.baeldung.com/java-use-remove-item-stream) | - [Operating on and Removing an Item from Stream](https://www.baeldung.com/java-use-remove-item-stream) | ||||||
| - [An Introduction to Synchronized Java Collections](https://www.baeldung.com/java-synchronized-collections) | - [An Introduction to Synchronized Java Collections](https://www.baeldung.com/java-synchronized-collections) | ||||||
| - [Guide to EnumSet](https://www.baeldung.com/java-enumset) | - [Guide to EnumSet](https://www.baeldung.com/java-enumset) | ||||||
|  | - [Removing Elements from Java Collections](https://www.baeldung.com/java-collection-remove-elements) | ||||||
|  | - [Converting a Collection to ArrayList in Java](https://www.baeldung.com/java-convert-collection-arraylist) | ||||||
|  | - [Java 8 Streams: Find Items From One List Based On Values From Another List](https://www.baeldung.com/java-streams-find-list-items) | ||||||
|  | - [Combining Different Types of Collections in Java](https://www.baeldung.com/java-combine-collections) | ||||||
|  | - [Sorting in Java](http://www.baeldung.com/java-sorting) | ||||||
|  | - [A Guide to the Java LinkedList](http://www.baeldung.com/java-linkedlist) | ||||||
|  | - [Java List UnsupportedOperationException](http://www.baeldung.com/java-list-unsupported-operation-exception) | ||||||
|  | - [Join and Split Arrays and Collections in Java](http://www.baeldung.com/java-join-and-split) | ||||||
|  | - [Check If Two Lists are Equal in Java](http://www.baeldung.com/java-test-a-list-for-ordinality-and-equality) | ||||||
|  | - [Java List Initialization in One Line](https://www.baeldung.com/java-init-list-one-line) | ||||||
|  | - [ClassCastException: Arrays$ArrayList cannot be cast to ArrayList](https://www.baeldung.com/java-classcastexception-arrays-arraylist) | ||||||
|  | |||||||
| @ -56,6 +56,12 @@ | |||||||
|             <artifactId>commons-exec</artifactId> |             <artifactId>commons-exec</artifactId> | ||||||
|             <version>1.3</version> |             <version>1.3</version> | ||||||
|         </dependency> |         </dependency> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.projectlombok</groupId> | ||||||
|  |             <artifactId>lombok</artifactId> | ||||||
|  |             <version>${lombok.version}</version> | ||||||
|  |             <scope>provided</scope> | ||||||
|  |         </dependency> | ||||||
|     </dependencies> |     </dependencies> | ||||||
| 
 | 
 | ||||||
|     <properties> |     <properties> | ||||||
| @ -67,5 +73,6 @@ | |||||||
|         <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> | ||||||
|         <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> | ||||||
|     </properties> |     </properties> | ||||||
| </project> | </project> | ||||||
|  | |||||||
| @ -2,55 +2,47 @@ package com.baeldung.concurrent.evenandodd; | |||||||
| 
 | 
 | ||||||
| import java.util.concurrent.Semaphore; | import java.util.concurrent.Semaphore; | ||||||
| 
 | 
 | ||||||
| public class SemaphoreDemo { | public class PrintEvenOddSemaphore { | ||||||
| 
 | 
 | ||||||
|     public static void main(String[] args) { |     public static void main(String[] args) { | ||||||
| 
 |  | ||||||
|         SharedPrinter sp = new SharedPrinter(); |         SharedPrinter sp = new SharedPrinter(); | ||||||
|         Thread odd = new Thread(new Odd(sp, 10)); |         Thread odd = new Thread(new Odd(sp, 10), "Odd"); | ||||||
|         odd.setName("Odd"); |         Thread even = new Thread(new Even(sp, 10), "Even"); | ||||||
|         Thread even = new Thread(new Even(sp, 10)); |  | ||||||
|         even.setName("Even"); |  | ||||||
| 
 | 
 | ||||||
|         odd.start(); |         odd.start(); | ||||||
|         even.start(); |         even.start(); | ||||||
| 
 |  | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| class SharedPrinter { | class SharedPrinter { | ||||||
| 
 | 
 | ||||||
|     Semaphore semEven = new Semaphore(0); |     private final Semaphore semEven = new Semaphore(0); | ||||||
|     Semaphore semOdd = new Semaphore(1); |     private final Semaphore semOdd = new Semaphore(1); | ||||||
| 
 | 
 | ||||||
|     public void printEvenNum(int num) { |     void printEvenNum(int num) { | ||||||
|         try { |         try { | ||||||
|             semEven.acquire(); |             semEven.acquire(); | ||||||
|         } catch (InterruptedException e) { |         } catch (InterruptedException e) { | ||||||
|             e.printStackTrace(); |             Thread.currentThread().interrupt(); | ||||||
|         } |         } | ||||||
|         System.out.println(Thread.currentThread() |         System.out.println(Thread.currentThread().getName() + ":"+num); | ||||||
|             .getName() + ":"+num); |  | ||||||
|         semOdd.release(); |         semOdd.release(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public void printOddNum(int num) { |     void printOddNum(int num) { | ||||||
|         try { |         try { | ||||||
|             semOdd.acquire(); |             semOdd.acquire(); | ||||||
|         } catch (InterruptedException e) { |         } catch (InterruptedException e) { | ||||||
|             e.printStackTrace(); |             Thread.currentThread().interrupt(); | ||||||
|         } |         } | ||||||
|         System.out.println(Thread.currentThread() |         System.out.println(Thread.currentThread().getName() + ":"+ num); | ||||||
|             .getName() + ":"+ num); |  | ||||||
|         semEven.release(); |         semEven.release(); | ||||||
| 
 |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| class Even implements Runnable { | class Even implements Runnable { | ||||||
|     SharedPrinter sp; |     private final SharedPrinter sp; | ||||||
|     int max; |     private final int max; | ||||||
| 
 | 
 | ||||||
|     Even(SharedPrinter sp, int max) { |     Even(SharedPrinter sp, int max) { | ||||||
|         this.sp = sp; |         this.sp = sp; | ||||||
| @ -66,8 +58,8 @@ class Even implements Runnable { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| class Odd implements Runnable { | class Odd implements Runnable { | ||||||
|     SharedPrinter sp; |     private SharedPrinter sp; | ||||||
|     int max; |     private int max; | ||||||
| 
 | 
 | ||||||
|     Odd(SharedPrinter sp, int max) { |     Odd(SharedPrinter sp, int max) { | ||||||
|         this.sp = sp; |         this.sp = sp; | ||||||
| @ -1,22 +1,20 @@ | |||||||
| package com.baeldung.concurrent.evenandodd; | package com.baeldung.concurrent.evenandodd; | ||||||
| 
 | 
 | ||||||
| public class PrintEvenOdd { | public class PrintEvenOddWaitNotify { | ||||||
| 
 | 
 | ||||||
|     public static void main(String... args) { |     public static void main(String... args) { | ||||||
|         Printer print = new Printer(); |         Printer print = new Printer(); | ||||||
|         Thread t1 = new Thread(new TaskEvenOdd(print, 10, false)); |         Thread t1 = new Thread(new TaskEvenOdd(print, 10, false), "Odd"); | ||||||
|         t1.setName("Odd"); |         Thread t2 = new Thread(new TaskEvenOdd(print, 10, true), "Even"); | ||||||
|         Thread t2 = new Thread(new TaskEvenOdd(print, 10, true)); |  | ||||||
|         t2.setName("Even"); |  | ||||||
|         t1.start(); |         t1.start(); | ||||||
|         t2.start(); |         t2.start(); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| class TaskEvenOdd implements Runnable { | class TaskEvenOdd implements Runnable { | ||||||
|     private int max; |     private final int max; | ||||||
|     private Printer print; |     private final Printer print; | ||||||
|     private boolean isEvenNumber; |     private final boolean isEvenNumber; | ||||||
| 
 | 
 | ||||||
|     TaskEvenOdd(Printer print, int max, boolean isEvenNumber) { |     TaskEvenOdd(Printer print, int max, boolean isEvenNumber) { | ||||||
|         this.print = print; |         this.print = print; | ||||||
| @ -26,7 +24,7 @@ class TaskEvenOdd implements Runnable { | |||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public void run() { |     public void run() { | ||||||
|         int number = isEvenNumber == true ? 2 : 1; |         int number = isEvenNumber ? 2 : 1; | ||||||
|         while (number <= max) { |         while (number <= max) { | ||||||
|             if (isEvenNumber) { |             if (isEvenNumber) { | ||||||
|                 print.printEven(number); |                 print.printEven(number); | ||||||
| @ -39,32 +37,30 @@ class TaskEvenOdd implements Runnable { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| class Printer { | class Printer { | ||||||
|     boolean isOdd = false; |     private volatile boolean isOdd; | ||||||
| 
 | 
 | ||||||
|     synchronized void printEven(int number) { |     synchronized void printEven(int number) { | ||||||
|         while (isOdd == false) { |         while (!isOdd) { | ||||||
|             try { |             try { | ||||||
|                 wait(); |                 wait(); | ||||||
|             } catch (InterruptedException e) { |             } catch (InterruptedException e) { | ||||||
|                 e.printStackTrace(); |                 Thread.currentThread().interrupt(); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         System.out.println(Thread.currentThread() |         System.out.println(Thread.currentThread().getName() + ":" + number); | ||||||
|             .getName() + ":" + number); |  | ||||||
|         isOdd = false; |         isOdd = false; | ||||||
|         notify(); |         notify(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     synchronized void printOdd(int number) { |     synchronized void printOdd(int number) { | ||||||
|         while (isOdd == true) { |         while (isOdd) { | ||||||
|             try { |             try { | ||||||
|                 wait(); |                 wait(); | ||||||
|             } catch (InterruptedException e) { |             } catch (InterruptedException e) { | ||||||
|                 e.printStackTrace(); |                 Thread.currentThread().interrupt(); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         System.out.println(Thread.currentThread() |         System.out.println(Thread.currentThread().getName() + ":" + number); | ||||||
|             .getName() + ":" + number); |  | ||||||
|         isOdd = true; |         isOdd = true; | ||||||
|         notify(); |         notify(); | ||||||
|     } |     } | ||||||
| @ -33,3 +33,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) | ||||||
| - [Read a File into an ArrayList](https://www.baeldung.com/java-file-to-arraylist) | - [Read a File into an ArrayList](https://www.baeldung.com/java-file-to-arraylist) | ||||||
| - [Guide to Java OutputStream](https://www.baeldung.com/java-outputstream) | - [Guide to Java OutputStream](https://www.baeldung.com/java-outputstream) | ||||||
|  | - [Reading a CSV File into an Array](https://www.baeldung.com/java-csv-file-array) | ||||||
|  | |||||||
							
								
								
									
										25
									
								
								core-java-lang/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								core-java-lang/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,25 @@ | |||||||
|  | *.class | ||||||
|  | 
 | ||||||
|  | 0.* | ||||||
|  | 
 | ||||||
|  | #folders# | ||||||
|  | /target | ||||||
|  | /neoDb* | ||||||
|  | /data | ||||||
|  | /src/main/webapp/WEB-INF/classes | ||||||
|  | */META-INF/* | ||||||
|  | .resourceCache | ||||||
|  | 
 | ||||||
|  | # Packaged files # | ||||||
|  | *.jar | ||||||
|  | *.war | ||||||
|  | *.ear | ||||||
|  | 
 | ||||||
|  | # Files generated by integration tests | ||||||
|  | backup-pom.xml | ||||||
|  | /bin/ | ||||||
|  | /temp | ||||||
|  | 
 | ||||||
|  | #IntelliJ specific | ||||||
|  | .idea/ | ||||||
|  | *.iml | ||||||
							
								
								
									
										59
									
								
								core-java-lang/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										59
									
								
								core-java-lang/README.md
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,59 @@ | |||||||
|  | ========= | ||||||
|  | 
 | ||||||
|  | ## Core Java Lang Cookbooks and Examples | ||||||
|  | 
 | ||||||
|  | ### Relevant Articles:  | ||||||
|  | - [Guide to Java Reflection](http://www.baeldung.com/java-reflection) | ||||||
|  | - [Introduction to Java Generics](http://www.baeldung.com/java-generics) | ||||||
|  | - [Generate equals() and hashCode() with Eclipse](http://www.baeldung.com/java-eclipse-equals-and-hashcode) | ||||||
|  | - [Chained Exceptions in Java](http://www.baeldung.com/java-chained-exceptions) | ||||||
|  | - [Java Primitive Conversions](http://www.baeldung.com/java-primitive-conversions) | ||||||
|  | - [Call Methods at Runtime Using Java Reflection](http://www.baeldung.com/java-method-reflection) | ||||||
|  | - [Iterating Over Enum Values in Java](http://www.baeldung.com/java-enum-iteration) | ||||||
|  | - [Changing Annotation Parameters At Runtime](http://www.baeldung.com/java-reflection-change-annotation-params) | ||||||
|  | - [Dynamic Proxies in Java](http://www.baeldung.com/java-dynamic-proxies) | ||||||
|  | - [Java Double Brace Initialization](http://www.baeldung.com/java-double-brace-initialization) | ||||||
|  | - [Guide to hashCode() in Java](http://www.baeldung.com/java-hashcode) | ||||||
|  | - [Guide to the Diamond Operator in Java](http://www.baeldung.com/java-diamond-operator) | ||||||
|  | - [A Guide to the Static Keyword in Java](http://www.baeldung.com/java-static) | ||||||
|  | - [Quick Example - Comparator vs Comparable in Java](http://www.baeldung.com/java-comparator-comparable) | ||||||
|  | - [The Java continue and break Keywords](http://www.baeldung.com/java-continue-and-break) | ||||||
|  | - [A Guide to Java Initialization](http://www.baeldung.com/java-initialization) | ||||||
|  | - [Nested Classes in Java](http://www.baeldung.com/java-nested-classes) | ||||||
|  | - [A Guide to Java Loops](http://www.baeldung.com/java-loops) | ||||||
|  | - [Varargs in Java](http://www.baeldung.com/java-varargs) | ||||||
|  | - [A Guide to Inner Interfaces in Java](http://www.baeldung.com/java-inner-interfaces) | ||||||
|  | - [Polymorphism in Java](http://www.baeldung.com/java-polymorphism) | ||||||
|  | - [Recursion In Java](http://www.baeldung.com/java-recursion) | ||||||
|  | - [A Guide to the finalize Method in Java](http://www.baeldung.com/java-finalize) | ||||||
|  | - [Method Overloading and Overriding in Java](http://www.baeldung.com/java-method-overload-override) | ||||||
|  | - [How to Make a Deep Copy of an Object in Java](http://www.baeldung.com/java-deep-copy) | ||||||
|  | - [Guide to Inheritance in Java](http://www.baeldung.com/java-inheritance) | ||||||
|  | - [Object Type Casting in Java](http://www.baeldung.com/java-type-casting) | ||||||
|  | - [The "final" Keyword in Java](http://www.baeldung.com/java-final) | ||||||
|  | - [A Guide to Java Enums](http://www.baeldung.com/a-guide-to-java-enums) | ||||||
|  | - [Infinite Loops in Java](http://www.baeldung.com/infinite-loops-java) | ||||||
|  | - [Quick Guide to java.lang.System](http://www.baeldung.com/java-lang-system) | ||||||
|  | - [Type Erasure in Java Explained](http://www.baeldung.com/java-type-erasure) | ||||||
|  | - [Using Java Assertions](http://www.baeldung.com/java-assert) | ||||||
|  | - [Pass-By-Value as a Parameter Passing Mechanism in Java](http://www.baeldung.com/java-pass-by-value-or-pass-by-reference) | ||||||
|  | - [Variable and Method Hiding in Java](http://www.baeldung.com/java-variable-method-hiding) | ||||||
|  | - [Access Modifiers in Java](http://www.baeldung.com/java-access-modifiers) | ||||||
|  | - [Guide to the super Java Keyword](http://www.baeldung.com/java-super) | ||||||
|  | - [Guide to the this Java Keyword](http://www.baeldung.com/java-this) | ||||||
|  | - [Immutable Objects in Java](http://www.baeldung.com/java-immutable-object) | ||||||
|  | - [ClassNotFoundException vs NoClassDefFoundError](http://www.baeldung.com/java-classnotfoundexception-and-noclassdeffounderror) | ||||||
|  | - [The StackOverflowError in Java](http://www.baeldung.com/java-stack-overflow-error) | ||||||
|  | - [Create a Custom Exception in Java](http://www.baeldung.com/java-new-custom-exception) | ||||||
|  | - [Exception Handling in Java](http://www.baeldung.com/java-exceptions) | ||||||
|  | - [Differences Between Final, Finally and Finalize in Java](https://www.baeldung.com/java-final-finally-finalize) | ||||||
|  | - [Static and Dynamic Binding in Java](https://www.baeldung.com/java-static-dynamic-binding) | ||||||
|  | - [Difference Between Throw and Throws in Java](https://www.baeldung.com/java-throw-throws) | ||||||
|  | - [Synthetic Constructs in Java](https://www.baeldung.com/java-synthetic) | ||||||
|  | - [Java Switch Statement](https://www.baeldung.com/java-switch) | ||||||
|  | - [The Modulo Operator in Java](https://www.baeldung.com/modulo-java) | ||||||
|  | - [Ternary Operator In Java](https://www.baeldung.com/java-ternary-operator) | ||||||
|  | - [How to Separate Double into Integer and Decimal Parts](https://www.baeldung.com/java-separate-double-into-integer-decimal-parts) | ||||||
|  | - [“Sneaky Throws” in Java](http://www.baeldung.com/java-sneaky-throws) | ||||||
|  | - [Inheritance and Composition (Is-a vs Has-a relationship) in Java](http://www.baeldung.com/java-inheritance-composition) | ||||||
|  | 
 | ||||||
							
								
								
									
										429
									
								
								core-java-lang/pom.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										429
									
								
								core-java-lang/pom.xml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,429 @@ | |||||||
|  | <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"> | ||||||
|  |     <modelVersion>4.0.0</modelVersion> | ||||||
|  |     <groupId>com.baeldung</groupId> | ||||||
|  |     <artifactId>core-java-lang</artifactId> | ||||||
|  |     <version>0.1.0-SNAPSHOT</version> | ||||||
|  |     <packaging>jar</packaging> | ||||||
|  |     <name>core-java-lang</name> | ||||||
|  | 
 | ||||||
|  |     <parent> | ||||||
|  |         <groupId>com.baeldung</groupId> | ||||||
|  |         <artifactId>parent-java</artifactId> | ||||||
|  |         <version>0.0.1-SNAPSHOT</version> | ||||||
|  |         <relativePath>../parent-java</relativePath> | ||||||
|  |     </parent> | ||||||
|  | 
 | ||||||
|  |     <dependencies> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.apache.commons</groupId> | ||||||
|  |             <artifactId>commons-lang3</artifactId> | ||||||
|  |             <version>${commons-lang3.version}</version> | ||||||
|  |         </dependency> | ||||||
|  |         <!-- web --> | ||||||
|  |         <!-- marshalling --> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>com.fasterxml.jackson.core</groupId> | ||||||
|  |             <artifactId>jackson-databind</artifactId> | ||||||
|  |             <version>${jackson.version}</version> | ||||||
|  |         </dependency> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>com.google.code.gson</groupId> | ||||||
|  |             <artifactId>gson</artifactId> | ||||||
|  |             <version>${gson.version}</version> | ||||||
|  |         </dependency> | ||||||
|  |         <!-- logging --> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>log4j</groupId> | ||||||
|  |             <artifactId>log4j</artifactId> | ||||||
|  |             <version>${log4j.version}</version> | ||||||
|  |         </dependency> | ||||||
|  |         <dependency> <!-- needed to bridge to slf4j for projects that use the log4j APIs directly --> | ||||||
|  |             <groupId>org.slf4j</groupId> | ||||||
|  |             <artifactId>log4j-over-slf4j</artifactId> | ||||||
|  |             <version>${org.slf4j.version}</version> | ||||||
|  |         </dependency> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.projectlombok</groupId> | ||||||
|  |             <artifactId>lombok</artifactId> | ||||||
|  |             <version>${lombok.version}</version> | ||||||
|  |             <scope>provided</scope> | ||||||
|  |         </dependency> | ||||||
|  |         <!-- test scoped --> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.assertj</groupId> | ||||||
|  |             <artifactId>assertj-core</artifactId> | ||||||
|  |             <version>${assertj-core.version}</version> | ||||||
|  |             <scope>test</scope> | ||||||
|  |         </dependency> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>org.springframework</groupId> | ||||||
|  |             <artifactId>spring-web</artifactId> | ||||||
|  |             <version>${springframework.spring-web.version}</version> | ||||||
|  |         </dependency> | ||||||
|  |         <dependency> | ||||||
|  |             <groupId>javax.mail</groupId> | ||||||
|  |             <artifactId>mail</artifactId> | ||||||
|  |             <version>${javax.mail.version}</version> | ||||||
|  |         </dependency> | ||||||
|  |     </dependencies> | ||||||
|  | 
 | ||||||
|  |     <build> | ||||||
|  |         <finalName>core-java-lang</finalName> | ||||||
|  |         <resources> | ||||||
|  |             <resource> | ||||||
|  |                 <directory>src/main/resources</directory> | ||||||
|  |                 <filtering>true</filtering> | ||||||
|  |             </resource> | ||||||
|  |         </resources> | ||||||
|  | 
 | ||||||
|  |         <plugins> | ||||||
|  |             <plugin> | ||||||
|  |                 <groupId>org.apache.maven.plugins</groupId> | ||||||
|  |                 <artifactId>maven-surefire-plugin</artifactId> | ||||||
|  |                 <configuration> | ||||||
|  |                     <excludes> | ||||||
|  |                         <exclude>**/*LiveTest.java</exclude> | ||||||
|  |                         <exclude>**/*IntegrationTest.java</exclude> | ||||||
|  |                         <exclude>**/*IntTest.java</exclude> | ||||||
|  |                         <exclude>**/*LongRunningUnitTest.java</exclude> | ||||||
|  |                         <exclude>**/*ManualTest.java</exclude> | ||||||
|  |                     </excludes> | ||||||
|  |                     <testFailureIgnore>true</testFailureIgnore> | ||||||
|  |                 </configuration> | ||||||
|  |             </plugin> | ||||||
|  | 
 | ||||||
|  |             <plugin> | ||||||
|  |                 <groupId>org.apache.maven.plugins</groupId> | ||||||
|  |                 <artifactId>maven-dependency-plugin</artifactId> | ||||||
|  |                 <executions> | ||||||
|  |                     <execution> | ||||||
|  |                         <id>copy-dependencies</id> | ||||||
|  |                         <phase>prepare-package</phase> | ||||||
|  |                         <goals> | ||||||
|  |                             <goal>copy-dependencies</goal> | ||||||
|  |                         </goals> | ||||||
|  |                         <configuration> | ||||||
|  |                             <outputDirectory>${project.build.directory}/libs</outputDirectory> | ||||||
|  |                         </configuration> | ||||||
|  |                     </execution> | ||||||
|  |                 </executions> | ||||||
|  |             </plugin> | ||||||
|  | 
 | ||||||
|  |             <plugin> | ||||||
|  |                 <groupId>org.apache.maven.plugins</groupId> | ||||||
|  |                 <artifactId>maven-jar-plugin</artifactId> | ||||||
|  |                 <version>${maven-jar-plugin.version}</version> | ||||||
|  |                 <configuration> | ||||||
|  |                     <archive> | ||||||
|  |                         <manifest> | ||||||
|  |                             <addClasspath>true</addClasspath> | ||||||
|  |                             <classpathPrefix>libs/</classpathPrefix> | ||||||
|  |                             <mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass> | ||||||
|  |                         </manifest> | ||||||
|  |                     </archive> | ||||||
|  |                 </configuration> | ||||||
|  |             </plugin> | ||||||
|  | 
 | ||||||
|  |             <plugin> | ||||||
|  |                 <groupId>org.apache.maven.plugins</groupId> | ||||||
|  |                 <artifactId>maven-assembly-plugin</artifactId> | ||||||
|  |                 <executions> | ||||||
|  |                     <execution> | ||||||
|  |                         <phase>package</phase> | ||||||
|  |                         <goals> | ||||||
|  |                             <goal>single</goal> | ||||||
|  |                         </goals> | ||||||
|  |                         <configuration> | ||||||
|  |                             <archiveBaseDirectory>${project.basedir}</archiveBaseDirectory> | ||||||
|  |                             <archive> | ||||||
|  |                                 <manifest> | ||||||
|  |                                     <mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass> | ||||||
|  |                                 </manifest> | ||||||
|  |                             </archive> | ||||||
|  |                             <descriptorRefs> | ||||||
|  |                                 <descriptorRef>jar-with-dependencies</descriptorRef> | ||||||
|  |                             </descriptorRefs> | ||||||
|  |                         </configuration> | ||||||
|  |                     </execution> | ||||||
|  |                 </executions> | ||||||
|  |             </plugin> | ||||||
|  | 
 | ||||||
|  |             <plugin> | ||||||
|  |                 <groupId>org.apache.maven.plugins</groupId> | ||||||
|  |                 <artifactId>maven-shade-plugin</artifactId> | ||||||
|  |                 <version>${maven-shade-plugin.version}</version> | ||||||
|  |                 <executions> | ||||||
|  |                     <execution> | ||||||
|  |                         <goals> | ||||||
|  |                             <goal>shade</goal> | ||||||
|  |                         </goals> | ||||||
|  |                         <configuration> | ||||||
|  |                             <shadedArtifactAttached>true</shadedArtifactAttached> | ||||||
|  |                             <transformers> | ||||||
|  |                                 <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> | ||||||
|  |                                     <mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass> | ||||||
|  |                                 </transformer> | ||||||
|  |                             </transformers> | ||||||
|  |                         </configuration> | ||||||
|  |                     </execution> | ||||||
|  |                 </executions> | ||||||
|  |             </plugin> | ||||||
|  | 
 | ||||||
|  |             <plugin> | ||||||
|  |                 <groupId>com.jolira</groupId> | ||||||
|  |                 <artifactId>onejar-maven-plugin</artifactId> | ||||||
|  |                 <version>${onejar-maven-plugin.version}</version> | ||||||
|  |                 <executions> | ||||||
|  |                     <execution> | ||||||
|  |                         <configuration> | ||||||
|  |                             <mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass> | ||||||
|  |                             <attachToBuild>true</attachToBuild> | ||||||
|  |                             <filename>${project.build.finalName}-onejar.${project.packaging}</filename> | ||||||
|  |                         </configuration> | ||||||
|  |                         <goals> | ||||||
|  |                             <goal>one-jar</goal> | ||||||
|  |                         </goals> | ||||||
|  |                     </execution> | ||||||
|  |                 </executions> | ||||||
|  |             </plugin> | ||||||
|  | 
 | ||||||
|  |             <plugin> | ||||||
|  |                 <groupId>org.springframework.boot</groupId> | ||||||
|  |                 <artifactId>spring-boot-maven-plugin</artifactId> | ||||||
|  |                 <version>${spring-boot-maven-plugin.version}</version> | ||||||
|  |                 <executions> | ||||||
|  |                     <execution> | ||||||
|  |                         <goals> | ||||||
|  |                             <goal>repackage</goal> | ||||||
|  |                         </goals> | ||||||
|  |                         <configuration> | ||||||
|  |                             <classifier>spring-boot</classifier> | ||||||
|  |                             <mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass> | ||||||
|  |                         </configuration> | ||||||
|  |                     </execution> | ||||||
|  |                 </executions> | ||||||
|  |             </plugin> | ||||||
|  | 
 | ||||||
|  |             <plugin> | ||||||
|  |                 <groupId>org.codehaus.mojo</groupId> | ||||||
|  |                 <artifactId>exec-maven-plugin</artifactId> | ||||||
|  |                 <version>${exec-maven-plugin.version}</version> | ||||||
|  |                 <configuration> | ||||||
|  |                     <executable>java</executable> | ||||||
|  |                     <mainClass>com.baeldung.outofmemoryerror.OutOfMemoryGCLimitExceed</mainClass> | ||||||
|  |                     <arguments> | ||||||
|  |                         <argument>-Xmx300m</argument> | ||||||
|  |                         <argument>-XX:+UseParallelGC</argument> | ||||||
|  |                         <argument>-classpath</argument> | ||||||
|  |                         <classpath /> | ||||||
|  |                         <argument>com.baeldung.outofmemoryerror.OutOfMemoryGCLimitExceed</argument> | ||||||
|  |                     </arguments> | ||||||
|  |                 </configuration> | ||||||
|  |             </plugin> | ||||||
|  |              | ||||||
|  |             <plugin> | ||||||
|  |                 <groupId>org.apache.maven.plugins</groupId> | ||||||
|  |                 <artifactId>maven-javadoc-plugin</artifactId> | ||||||
|  |                 <version>${maven-javadoc-plugin.version}</version> | ||||||
|  |                 <configuration> | ||||||
|  |                     <source>1.8</source> | ||||||
|  |                     <target>1.8</target> | ||||||
|  |                 </configuration> | ||||||
|  |             </plugin> | ||||||
|  |         </plugins> | ||||||
|  |     </build> | ||||||
|  | 
 | ||||||
|  |     <profiles> | ||||||
|  |         <profile> | ||||||
|  |             <id>integration</id> | ||||||
|  |             <build> | ||||||
|  |                 <plugins> | ||||||
|  |                     <plugin> | ||||||
|  |                         <groupId>org.apache.maven.plugins</groupId> | ||||||
|  |                         <artifactId>maven-surefire-plugin</artifactId> | ||||||
|  |                         <executions> | ||||||
|  |                             <execution> | ||||||
|  |                                 <phase>integration-test</phase> | ||||||
|  |                                 <goals> | ||||||
|  |                                     <goal>test</goal> | ||||||
|  |                                 </goals> | ||||||
|  |                                 <configuration> | ||||||
|  |                                     <excludes> | ||||||
|  |                                         <exclude>**/*ManualTest.java</exclude> | ||||||
|  |                                     </excludes> | ||||||
|  |                                     <includes> | ||||||
|  |                                         <include>**/*IntegrationTest.java</include> | ||||||
|  |                                         <include>**/*IntTest.java</include> | ||||||
|  |                                     </includes> | ||||||
|  |                                 </configuration> | ||||||
|  |                             </execution> | ||||||
|  |                         </executions> | ||||||
|  |                         <configuration> | ||||||
|  |                             <systemPropertyVariables> | ||||||
|  |                                 <test.mime>json</test.mime> | ||||||
|  |                             </systemPropertyVariables> | ||||||
|  |                         </configuration> | ||||||
|  |                     </plugin> | ||||||
|  |                     <plugin> | ||||||
|  |                         <groupId>org.codehaus.mojo</groupId> | ||||||
|  |                         <artifactId>exec-maven-plugin</artifactId> | ||||||
|  |                         <version>${exec-maven-plugin.version}</version> | ||||||
|  |                         <executions> | ||||||
|  |                             <execution> | ||||||
|  |                                 <id>run-benchmarks</id> | ||||||
|  |                                 <!-- <phase>integration-test</phase> --> | ||||||
|  |                                 <phase>none</phase> | ||||||
|  |                                 <goals> | ||||||
|  |                                     <goal>exec</goal> | ||||||
|  |                                 </goals> | ||||||
|  |                                 <configuration> | ||||||
|  |                                     <classpathScope>test</classpathScope> | ||||||
|  |                                     <executable>java</executable> | ||||||
|  |                                     <arguments> | ||||||
|  |                                         <argument>-classpath</argument> | ||||||
|  |                                         <classpath /> | ||||||
|  |                                         <argument>org.openjdk.jmh.Main</argument> | ||||||
|  |                                         <argument>.*</argument> | ||||||
|  |                                     </arguments> | ||||||
|  |                                 </configuration> | ||||||
|  |                             </execution> | ||||||
|  |                         </executions> | ||||||
|  |                     </plugin> | ||||||
|  |                 </plugins> | ||||||
|  |             </build> | ||||||
|  |         </profile> | ||||||
|  | 
 | ||||||
|  |         <!-- java instrumentation profiles to build jars --> | ||||||
|  |         <profile> | ||||||
|  |             <id>buildAgentLoader</id> | ||||||
|  |             <build> | ||||||
|  |                 <plugins> | ||||||
|  |                     <plugin> | ||||||
|  |                         <groupId>org.apache.maven.plugins</groupId> | ||||||
|  |                         <artifactId>maven-jar-plugin</artifactId> | ||||||
|  |                         <executions> | ||||||
|  |                             <execution> | ||||||
|  |                                 <phase>package</phase> | ||||||
|  |                                 <goals> | ||||||
|  |                                     <goal>jar</goal> | ||||||
|  |                                 </goals> | ||||||
|  |                                 <configuration> | ||||||
|  |                                     <classifier>agentLoader</classifier> | ||||||
|  |                                     <classesDirectory>target/classes</classesDirectory> | ||||||
|  |                                     <archive> | ||||||
|  |                                         <manifest> | ||||||
|  |                                             <addClasspath>true</addClasspath> | ||||||
|  |                                         </manifest> | ||||||
|  |                                         <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> | ||||||
|  |                                     </archive> | ||||||
|  | 
 | ||||||
|  |                                     <includes> | ||||||
|  |                                         <include>com/baeldung/instrumentation/application/AgentLoader.class</include> | ||||||
|  |                                         <include>com/baeldung/instrumentation/application/Launcher.class</include> | ||||||
|  |                                     </includes> | ||||||
|  |                                 </configuration> | ||||||
|  |                             </execution> | ||||||
|  |                         </executions> | ||||||
|  |                     </plugin> | ||||||
|  |                 </plugins> | ||||||
|  |             </build> | ||||||
|  |         </profile> | ||||||
|  |         <profile> | ||||||
|  |             <id>buildApplication</id> | ||||||
|  |             <build> | ||||||
|  |                 <plugins> | ||||||
|  |                     <plugin> | ||||||
|  |                         <groupId>org.apache.maven.plugins</groupId> | ||||||
|  |                         <artifactId>maven-jar-plugin</artifactId> | ||||||
|  |                         <executions> | ||||||
|  |                             <execution> | ||||||
|  |                                 <phase>package</phase> | ||||||
|  |                                 <goals> | ||||||
|  |                                     <goal>jar</goal> | ||||||
|  |                                 </goals> | ||||||
|  |                                 <configuration> | ||||||
|  |                                     <classifier>application</classifier> | ||||||
|  |                                     <classesDirectory>target/classes</classesDirectory> | ||||||
|  |                                     <archive> | ||||||
|  |                                         <manifest> | ||||||
|  |                                             <addClasspath>true</addClasspath> | ||||||
|  |                                         </manifest> | ||||||
|  |                                         <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> | ||||||
|  |                                     </archive> | ||||||
|  | 
 | ||||||
|  |                                     <includes> | ||||||
|  |                                         <include>com/baeldung/instrumentation/application/MyAtm.class</include> | ||||||
|  |                                         <include>com/baeldung/instrumentation/application/MyAtmApplication.class</include> | ||||||
|  |                                         <include>com/baeldung/instrumentation/application/Launcher.class</include> | ||||||
|  |                                     </includes> | ||||||
|  |                                 </configuration> | ||||||
|  |                             </execution> | ||||||
|  |                         </executions> | ||||||
|  |                     </plugin> | ||||||
|  |                 </plugins> | ||||||
|  |             </build> | ||||||
|  |         </profile> | ||||||
|  |         <profile> | ||||||
|  |             <id>buildAgent</id> | ||||||
|  |             <build> | ||||||
|  |                 <plugins> | ||||||
|  |                     <plugin> | ||||||
|  |                         <groupId>org.apache.maven.plugins</groupId> | ||||||
|  |                         <artifactId>maven-jar-plugin</artifactId> | ||||||
|  |                         <executions> | ||||||
|  |                             <execution> | ||||||
|  |                                 <phase>package</phase> | ||||||
|  |                                 <goals> | ||||||
|  |                                     <goal>jar</goal> | ||||||
|  |                                 </goals> | ||||||
|  |                                 <configuration> | ||||||
|  |                                     <classifier>agent</classifier> | ||||||
|  |                                     <classesDirectory>target/classes</classesDirectory> | ||||||
|  |                                     <archive> | ||||||
|  |                                         <manifest> | ||||||
|  |                                             <addClasspath>true</addClasspath> | ||||||
|  |                                         </manifest> | ||||||
|  |                                         <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> | ||||||
|  |                                     </archive> | ||||||
|  | 
 | ||||||
|  |                                     <includes> | ||||||
|  |                                         <include>com/baeldung/instrumentation/agent/AtmTransformer.class</include> | ||||||
|  |                                         <include>com/baeldung/instrumentation/agent/MyInstrumentationAgent.class</include> | ||||||
|  |                                     </includes> | ||||||
|  |                                 </configuration> | ||||||
|  |                             </execution> | ||||||
|  |                         </executions> | ||||||
|  |                     </plugin> | ||||||
|  |                 </plugins> | ||||||
|  |             </build> | ||||||
|  |         </profile> | ||||||
|  |     </profiles> | ||||||
|  | 
 | ||||||
|  |     <properties> | ||||||
|  |          | ||||||
|  |         <!-- marshalling --> | ||||||
|  |         <jackson.version>2.8.5</jackson.version> | ||||||
|  |         <gson.version>2.8.2</gson.version> | ||||||
|  | 
 | ||||||
|  |         <!-- util --> | ||||||
|  |         <commons-lang3.version>3.5</commons-lang3.version> | ||||||
|  |         <lombok.version>1.16.12</lombok.version> | ||||||
|  |          | ||||||
|  |         <javax.mail.version>1.5.0-b01</javax.mail.version> | ||||||
|  |          | ||||||
|  |         <!-- testing --> | ||||||
|  |         <assertj-core.version>3.10.0</assertj-core.version> | ||||||
|  | 
 | ||||||
|  |         <!-- maven and spring plugins --> | ||||||
|  |         <maven-surefire-plugin.version>2.21.0</maven-surefire-plugin.version> | ||||||
|  |         <springframework.spring-web.version>4.3.4.RELEASE</springframework.spring-web.version> | ||||||
|  |         <maven-javadoc-plugin.version>3.0.0-M1</maven-javadoc-plugin.version> | ||||||
|  |         <maven-jar-plugin.version>3.0.2</maven-jar-plugin.version> | ||||||
|  |         <onejar-maven-plugin.version>1.4.4</onejar-maven-plugin.version> | ||||||
|  |         <maven-shade-plugin.version>3.1.1</maven-shade-plugin.version> | ||||||
|  |         <spring-boot-maven-plugin.version>2.0.3.RELEASE</spring-boot-maven-plugin.version> | ||||||
|  |         <exec-maven-plugin.version>1.6.0</exec-maven-plugin.version> | ||||||
|  |     </properties> | ||||||
|  | 
 | ||||||
|  | </project> | ||||||
| @ -11,6 +11,7 @@ import java.util.Map.Entry; | |||||||
|  * @author Santosh |  * @author Santosh | ||||||
|  * |  * | ||||||
|  */ |  */ | ||||||
|  | 
 | ||||||
| public class BreakContinue { | public class BreakContinue { | ||||||
| 
 | 
 | ||||||
|     public static int unlabeledBreak() { |     public static int unlabeledBreak() { | ||||||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user