Home » core java » Page 13

Tag Archives: core java

Java 9 Immutable Collections Example

Hello, in this tutorial we will see another JDK 9 feature i.e. creating immutable collections in Java. Java 9 brings the long awaited approach for creating small unmodifiable Collection instances using a concise one line code. As per JEP 269, new convenience factory methods will be included in JDK 9. 1. Introduction Before Java 9, it was possible to create ...

Read More »

Java 9 Compact Strings Example

Hello, in this tutorial we will learn about the evolution of Strings in Java to Compact Strings. In any of the Java applications Strings are used extensively. I can’t remember a single application where I have not used Strings. So any optimization on String class would affect almost each and every application. 1. Introduction Since Java 9 is coming with ...

Read More »

Java XPath Using SAX Example

1. Introduction XPath is used to retrieve and interpret information represented in XML files using either a DOM or SAX parser. * DOM – Document Object Model – This popular class of parsers read the entire XML file and construct the DOM in memory. Since the DOM is memory resident, evaluation of the XPath expressions is faster. * SAX – ...

Read More »

JUnit RunListener Example

In JUnit RunListener Example, we shall show users how they can add RunListener to the test cases. There are cases when we want to respond to the events during a test case run. Here we can extend the RunListener class and override the methods according to our implementation. The JUnit RunListener can listen to the events of the JUnit lifecycle. ...

Read More »

JUnit MultiThreaded Test Example

In this post we shall show users how to test the multi threaded java application with the help of JUnit. JUnit MultiThread example clears users mind to understand the basic usage of testing the multi threading application. Users are advised to visit the JUnit Hello World example for basic understanding of the JUnit. For testing the methods by passing value ...

Read More »

JUnit Keyboard Input Example

In this post we shall show users the usage of JUnit keyboard input working. This example is very useful in case users want to enter data from keyboard for testing of their methods. Do not worry, we will the same in the post. Users are advised to see the JUnit Hello World example where they can see the basic usage ...

Read More »

JUnit FixMethodOrder Example

With this example, we are going to demonstrate users when, how and why JUnit FixMethodOrder annotation is used. In previous example JUnit Hello World, users have seen how they can start using JUnit. Users are advised to see the setup of project in JUnit Hello World example, if they want to continue with Maven. This example is useful in cases ...

Read More »

Java XPath Performance Tips

1. Introduction This is the third article in a series dealing with using XPath within a Java application. This article focuses attention on tips for improving XPath performance. The first two articles were: A Java XPath Best Practices Tutorial https://examples.javacodegeeks.com/core-java/xpath-best-practices-tutorial/ Which showed how to setup and evaluate XPath expressions using Java. Java XPath Examples https://examples.javacodegeeks.com/core-java/xml/xpath/java-xpath-examples/ Which explored XPath syntax and ...

Read More »

Java Nio Read File Example

With this example we are going to demonstrate how to use the Non-blocking I/O API, or NIO.2 API (NIO API) for short, to read the contents of a file. The examples in this article are compiled and run in a Mac OS unix environment. Please note that Java SE 8 is required to run the code in this article. 1. Introduction ...

Read More »

Docker Tutorial for Beginners

In this article we are going to explain the main features of Docker. We are going to briefly explain why containers are necessary, which are the main commands to use and how to use Docker in our integration tests. The following table shows an overview of the whole article:                 Table Of Contents ...

Read More »