This commit is contained in:
Seun Matt 2017-09-16 23:57:08 +01:00
commit 695d335e61
27 changed files with 90 additions and 7 deletions

View File

@ -8,3 +8,4 @@
- [Check If a Number Is Prime in Java](http://www.baeldung.com/java-prime-numbers) - [Check If a Number Is Prime in Java](http://www.baeldung.com/java-prime-numbers)
- [Example of Hill Climbing Algorithm](http://www.baeldung.com/java-hill-climbing-algorithm) - [Example of Hill Climbing Algorithm](http://www.baeldung.com/java-hill-climbing-algorithm)
- [Monte Carlo Tree Search for Tic-Tac-Toe Game](http://www.baeldung.com/java-monte-carlo-tree-search) - [Monte Carlo Tree Search for Tic-Tac-Toe Game](http://www.baeldung.com/java-monte-carlo-tree-search)
- [String Search Algorithms for Large Texts](http://www.baeldung.com/java-full-text-search-algorithms)

View File

@ -0,0 +1,2 @@
### Relevant articles
- [Introduction to Apache Shiro](http://www.baeldung.com/apache-shiro)

2
bootique/README.md Normal file
View File

@ -0,0 +1,2 @@
### Relevant Articles:
- [Introduction to Bootique](http://www.baeldung.com/bootique)

View File

@ -16,3 +16,4 @@
- [Java 9 Optional API Additions](http://www.baeldung.com/java-9-optional) - [Java 9 Optional API Additions](http://www.baeldung.com/java-9-optional)
- [Java 9 Reactive Streams](http://www.baeldung.com/java-9-reactive-streams) - [Java 9 Reactive Streams](http://www.baeldung.com/java-9-reactive-streams)
- [How to Get All Dates Between Two Dates?](http://www.baeldung.com/java-between-dates) - [How to Get All Dates Between Two Dates?](http://www.baeldung.com/java-between-dates)
- [Java 9 java.util.Objects Additions](http://www.baeldung.com/java-9-objects-new)

View File

@ -99,4 +99,10 @@
- [ClassNotFoundException vs NoClassDefFoundError](http://www.baeldung.com/java-classnotfoundexception-and-noclassdeffounderror) - [ClassNotFoundException vs NoClassDefFoundError](http://www.baeldung.com/java-classnotfoundexception-and-noclassdeffounderror)
- [Guide to UUID in Java](http://www.baeldung.com/java-uuid) - [Guide to UUID in Java](http://www.baeldung.com/java-uuid)
- [Guide to Escaping Characters in Java RegExps](http://www.baeldung.com/java-regexp-escape-char) - [Guide to Escaping Characters in Java RegExps](http://www.baeldung.com/java-regexp-escape-char)
- [Guide to hashCode() in Java](http://www.baeldung.com/java-hashcode)
- [Collect a Java Stream to an Immutable Collection](http://www.baeldung.com/java-stream-immutable-collection)
- [Difference between URL and URI](http://www.baeldung.com/java-url-vs-uri)
- [Broadcasting and Multicasting in Java](http://www.baeldung.com/java-broadcast-multicast)
- [Converting a List to String in Java](http://www.baeldung.com/java-list-to-string)
- [CharSequence vs. String in Java](http://www.baeldung.com/java-char-sequence-string)
- [Period and Duration in Java](http://www.baeldung.com/java-period-duration) - [Period and Duration in Java](http://www.baeldung.com/java-period-duration)

2
grpc/README.md Normal file
View File

@ -0,0 +1,2 @@
### Relevant Articles:
- [Introduction to gRPC](http://www.baeldung.com/grpc-introduction)

View File

@ -5,3 +5,4 @@
- [Introduction to JAX-WS](http://www.baeldung.com/jax-ws) - [Introduction to JAX-WS](http://www.baeldung.com/jax-ws)
- [A Guide to Java EE Web-Related Annotations](http://www.baeldung.com/javaee-web-annotations) - [A Guide to Java EE Web-Related Annotations](http://www.baeldung.com/javaee-web-annotations)
- [Introduction to Testing with Arquillian](http://www.baeldung.com/arquillian) - [Introduction to Testing with Arquillian](http://www.baeldung.com/arquillian)
- [Securing Java EE with Spring Security](http://www.baeldung.com/java-ee-spring-security)

View File

@ -5,3 +5,5 @@
- [A Guide to @RepeatedTest in Junit 5](http://www.baeldung.com/junit-5-repeated-test) - [A Guide to @RepeatedTest in Junit 5](http://www.baeldung.com/junit-5-repeated-test)
- [Guide to Dynamic Tests in Junit 5](http://www.baeldung.com/junit5-dynamic-tests) - [Guide to Dynamic Tests in Junit 5](http://www.baeldung.com/junit5-dynamic-tests)
- [A Guied to JUnit 5 Extensions](http://www.baeldung.com/junit-5-extensions) - [A Guied to JUnit 5 Extensions](http://www.baeldung.com/junit-5-extensions)
- [Inject Parameters into JUnit Jupiter Unit Tests](http://www.baeldung.com/junit-5-parameters)

View File

@ -13,4 +13,7 @@
- [Overview of Kotlin Collections API](http://www.baeldung.com/kotlin-collections-api) - [Overview of Kotlin Collections API](http://www.baeldung.com/kotlin-collections-api)
- [Converting a List to Map in Kotlin](http://www.baeldung.com/kotlin-list-to-map) - [Converting a List to Map in Kotlin](http://www.baeldung.com/kotlin-list-to-map)
- [Data Classes in Kotlin](http://www.baeldung.com/kotlin-data-classes) - [Data Classes in Kotlin](http://www.baeldung.com/kotlin-data-classes)
- [Delegated Properties in Kotlin](http://www.baeldung.com/kotlin-delegated-properties)
- [Sealed Classes in Kotlin](http://www.baeldung.com/kotlin-sealed-classes)

2
libraries-data/README.md Normal file
View File

@ -0,0 +1,2 @@
### Relevant articles
- [Introduction to Reladomo](http://www.baeldung.com/reladomo)

View File

@ -30,6 +30,14 @@
- [Introduction to Neuroph](http://www.baeldung.com/neuroph) - [Introduction to Neuroph](http://www.baeldung.com/neuroph)
- [Guide to Apache Commons CircularFifoQueue](http://www.baeldung.com/commons-circular-fifo-queue) - [Guide to Apache Commons CircularFifoQueue](http://www.baeldung.com/commons-circular-fifo-queue)
- [Quick Guide to RSS with Rome](http://www.baeldung.com/rome-rss) - [Quick Guide to RSS with Rome](http://www.baeldung.com/rome-rss)
- [Introduction to NoException](http://www.baeldung.com/intrduction-to-noexception)
- [Introduction to PCollections](http://www.baeldung.com/java-pcollections)
- [Introduction to Hoverfly in Java](http://www.baeldung.com/hoverfly)
- [Apache Commons Chain](http://www.baeldung.com/apache-commons-chain)
- [Introduction to Eclipse Collections](http://www.baeldung.com/eclipse-collections)
- [DistinctBy in Java Stream API](http://www.baeldung.com/java-streams-distinct-by)
- [Introduction to Apache Commons CSV](http://www.baeldung.com/apache-commons-csv)
- [Difference Between Two Dates in Java](http://www.baeldung.com/java-date-difference)
- [Introduction to NoException](http://www.baeldung.com/no-exception) - [Introduction to NoException](http://www.baeldung.com/no-exception)
- [Introduction to FunctionalJava](http://www.baeldung.com/functional-java) - [Introduction to FunctionalJava](http://www.baeldung.com/functional-java)
- [Apache Commons IO](http://www.baeldung.com/apache-commons-io) - [Apache Commons IO](http://www.baeldung.com/apache-commons-io)

View File

@ -0,0 +1,11 @@
package com.baeldung.commons.lang3;
import org.apache.commons.lang3.concurrent.LazyInitializer;
public class SampleLazyInitializer extends LazyInitializer<SampleObject> {
@Override
protected SampleObject initialize() {
return new SampleObject();
}
}

View File

@ -0,0 +1,7 @@
package com.baeldung.commons.lang3;
public class SampleObject {
//Ignored
}

View File

@ -1,6 +1,7 @@
package com.baeldung.commons.lang3; package com.baeldung.commons.lang3;
import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame; import static org.junit.Assert.assertSame;
@ -12,12 +13,14 @@ import java.beans.PropertyChangeListener;
import java.io.File; import java.io.File;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.Locale; import java.util.Locale;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import org.apache.commons.lang3.ArchUtils; import org.apache.commons.lang3.ArchUtils;
import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.SystemUtils; import org.apache.commons.lang3.SystemUtils;
import org.apache.commons.lang3.arch.Processor; import org.apache.commons.lang3.arch.Processor;
import org.apache.commons.lang3.concurrent.ConcurrentException;
import org.apache.commons.lang3.concurrent.ConcurrentRuntimeException; import org.apache.commons.lang3.concurrent.ConcurrentRuntimeException;
import org.apache.commons.lang3.concurrent.ConcurrentUtils; import org.apache.commons.lang3.concurrent.ConcurrentUtils;
import org.apache.commons.lang3.event.EventUtils; import org.apache.commons.lang3.event.EventUtils;
@ -97,22 +100,37 @@ public class Lang3UtilsTest {
public void testAddEventListenerThrowsException() { public void testAddEventListenerThrowsException() {
final ExceptionEventSource src = new ExceptionEventSource(); final ExceptionEventSource src = new ExceptionEventSource();
try { try {
EventUtils.addEventListener(src, PropertyChangeListener.class, new PropertyChangeListener() { EventUtils.addEventListener(src, PropertyChangeListener.class, (PropertyChangeEvent e) -> {
@Override /* Change event*/});
public void propertyChange(final PropertyChangeEvent e) {
// Do nothing!
}
});
fail("Add method should have thrown an exception, so method should fail."); fail("Add method should have thrown an exception, so method should fail.");
} catch (final RuntimeException e) { } catch (final RuntimeException e) {
} }
} }
@Test
public void ConcurrentExceptionSample() throws ConcurrentException {
final Error err = new AssertionError("Test");
try {
ConcurrentUtils.handleCause(new ExecutionException(err));
fail("Error not thrown!");
} catch (final Error e) {
assertEquals("Wrong error", err, e);
}
}
public static class ExceptionEventSource { public static class ExceptionEventSource {
public void addPropertyChangeListener(final PropertyChangeListener listener) { public void addPropertyChangeListener(final PropertyChangeListener listener) {
throw new RuntimeException(); throw new RuntimeException();
} }
} }
@Test
public void testLazyInitializer() throws Exception {
SampleLazyInitializer sampleLazyInitializer = new SampleLazyInitializer();
SampleObject sampleObjectOne = sampleLazyInitializer.get();
SampleObject sampleObjectTwo = sampleLazyInitializer.get();
assertEquals(sampleObjectOne, sampleObjectTwo);
}
} }

View File

@ -1,3 +1,4 @@
### Relevant articles ### Relevant articles
- [Intro to Log4j2 Appenders, Layouts and Filters](http://www.baeldung.com/log4j2-appenders-layouts-filters) - [Intro to Log4j2 Appenders, Layouts and Filters](http://www.baeldung.com/log4j2-appenders-layouts-filters)
- [Log4j 2 and Lambda Expressions](http://www.baeldung.com/log4j-2-lazy-logging)

View File

@ -3,3 +3,5 @@
- [Introduction to Ratpack](http://www.baeldung.com/ratpack) - [Introduction to Ratpack](http://www.baeldung.com/ratpack)
- [Ratpack Google Guice Integration](http://www.baeldung.com/ratpack-google-guice) - [Ratpack Google Guice Integration](http://www.baeldung.com/ratpack-google-guice)
- [Ratpack Integration with Spring Boot](http://www.baeldung.com/ratpack-spring-boot) - [Ratpack Integration with Spring Boot](http://www.baeldung.com/ratpack-spring-boot)
- [Ratpack with Hystrix](http://www.baeldung.com/ratpack-hystrix)

View File

@ -2,3 +2,4 @@
- [Dealing with Backpressure with RxJava](http://www.baeldung.com/rxjava-backpressure) - [Dealing with Backpressure with RxJava](http://www.baeldung.com/rxjava-backpressure)
- [How to Test RxJava?](http://www.baeldung.com/rxjava-testing) - [How to Test RxJava?](http://www.baeldung.com/rxjava-testing)
- [Implementing Custom Operators in RxJava](http://www.baeldung.com/rxjava-custom-operators)

View File

@ -9,3 +9,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [Introduction to the Functional Web Framework in Spring 5](http://www.baeldung.com/spring-5-functional-web) - [Introduction to the Functional Web Framework in Spring 5](http://www.baeldung.com/spring-5-functional-web)
- [Exploring the Spring 5 MVC URL Matching Improvements](http://www.baeldung.com/spring-5-mvc-url-matching) - [Exploring the Spring 5 MVC URL Matching Improvements](http://www.baeldung.com/spring-5-mvc-url-matching)
- [Spring 5 WebClient](http://www.baeldung.com/spring-5-webclient) - [Spring 5 WebClient](http://www.baeldung.com/spring-5-webclient)
- [Spring 5 Functional Bean Registration](http://www.baeldung.com/spring-5-functional-beans)

View File

@ -1,3 +1,5 @@
### Relevant articles ### Relevant articles
- [A Guide to Activiti with Java](http://www.baeldung.com/java-activiti) - [A Guide to Activiti with Java](http://www.baeldung.com/java-activiti)
- [Introduction to Activiti with Spring](http://www.baeldung.com/spring-activiti)

View File

@ -5,3 +5,4 @@
### Relevant Articles: ### Relevant Articles:
- [Introduction to Spring Batch](http://www.baeldung.com/introduction-to-spring-batch) - [Introduction to Spring Batch](http://www.baeldung.com/introduction-to-spring-batch)
- [Spring Batch using Partitioner](https://github.com/eugenp/tutorials/tree/master/spring-batch)

View File

@ -1,2 +1,3 @@
### Relevant Articles: ### Relevant Articles:
- [Bootstrap a Simple Application using Spring Boot](http://www.baeldung.com/spring-boot-start) - [Bootstrap a Simple Application using Spring Boot](http://www.baeldung.com/spring-boot-start)
- [Spring Boot Dependency Management with a Custom Parent](http://www.baeldung.com/spring-boot-dependency-management-custom-parent)

View File

@ -26,4 +26,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [How to Get All Spring-Managed Beans?](http://www.baeldung.com/spring-show-all-beans) - [How to Get All Spring-Managed Beans?](http://www.baeldung.com/spring-show-all-beans)
- [A Java Client for a WebSockets API](http://www.baeldung.com/websockets-api-java-spring-client) - [A Java Client for a WebSockets API](http://www.baeldung.com/websockets-api-java-spring-client)
- [Spring Boot and Togglz Aspect](http://www.baeldung.com/spring-togglz) - [Spring Boot and Togglz Aspect](http://www.baeldung.com/spring-togglz)
- [Getting Started with GraphQL and Spring Boot](http://www.baeldung.com/spring-graphql)

View File

@ -4,6 +4,7 @@
- [Spring LDAP Overview](http://www.baeldung.com/spring-ldap) - [Spring LDAP Overview](http://www.baeldung.com/spring-ldap)
- [Spring LDAP Example Project](http://www.baeldung.com/spring-ldap-overview/) - [Spring LDAP Example Project](http://www.baeldung.com/spring-ldap-overview/)
- [Guide to Spring Data LDAP](http://www.baeldung.com/spring-data-ldap)

View File

@ -1,3 +1,4 @@
## Relevant articles: ## Relevant articles:
- [HandlerAdapters in Spring MVC](http://www.baeldung.com/spring-mvc-handler-adapters) - [HandlerAdapters in Spring MVC](http://www.baeldung.com/spring-mvc-handler-adapters)
- [Template Engines for Spring](http://www.baeldung.com/spring-template-engines)

View File

@ -16,4 +16,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
- [HTTP PUT vs HTTP PATCH in a REST API](http://www.baeldung.com/http-put-patch-difference-spring) - [HTTP PUT vs HTTP PATCH in a REST API](http://www.baeldung.com/http-put-patch-difference-spring)
- [Exploring the Spring Boot TestRestTemplate](http://www.baeldung.com/spring-boot-testresttemplate) - [Exploring the Spring Boot TestRestTemplate](http://www.baeldung.com/spring-boot-testresttemplate)
- [Spring Log Incoming Requests](http://www.baeldung.com/spring-http-logging) - [Spring Log Incoming Requests](http://www.baeldung.com/spring-http-logging)
- [RequestBody and ResponseBody Annotations](http://www.baeldung.com/requestbody-and-responsebody-annotations) - [RequestBody and ResponseBody Annotations](http://www.baeldung.com/requestbody-and-responsebody-annotations)

View File

@ -13,3 +13,5 @@
- [Testing with JGoTesting](http://www.baeldung.com/jgotesting) - [Testing with JGoTesting](http://www.baeldung.com/jgotesting)
- [Introduction to JUnitParams](http://www.baeldung.com/junit-params) - [Introduction to JUnitParams](http://www.baeldung.com/junit-params)
- [Cucumber Java 8 Support](http://www.baeldung.com/cucumber-java-8-support) - [Cucumber Java 8 Support](http://www.baeldung.com/cucumber-java-8-support)
- [Introduction to Lambda Behave](http://www.baeldung.com/lambda-behave)

2
undertow/README.md Normal file
View File

@ -0,0 +1,2 @@
### Relevant Articles:
- [Introduction to JBoss Undertow](http://www.baeldung.com/jboss-undertow)