Home » Java » Core Java

Core Java

Testing with Hoverfly and Java Part 2: Delays

On the previous post we implemented json and Java based Hoverfly scenarios..Now it’s time to dive deeper and use other Ηoverfly features. A big part of testing has to do with negative scenarios. One of them is delays. Although we always mock a server and we are successful to reproduce erroneous scenarios one thing that is key to simulate in ...

Read More »

Keeping the Caller Busy

There are ways we could refactor the displayCart function, but consider a second what the caller is doing each time it wants to use the function. Consider this simple code example: 01 02 03 04 05 06 07 08 09 10 11 12 13 // caller String shoppingCartMessage = displayCart("You have %s", cart.size());   String otherMessage = displayCart("You saved %s", ...

Read More »

Java 8 Base64 Encoding and Decoding (With Examples)

Learn different ways to do base64 encoding and decoding functionality in java and using java 8 api, and also examples using the apache commons-codec. 1. Overview In this article, you’ll learn the different ways to do the base 64 encoding and decoding techniques in java 8 and other alternative libraries such as apache common API utility. Understand the techniques on ...

Read More »

Java 8 Optional Tutorial With Examples

A quick and in-depth tutorial to Optional API in java 8. Exploring various types of examples to understand the right usage. 1. Overview In this tutorial, You will learn in-depth about Java 8 Optional Class methods and its usages. Optional class is added to the java.util package. The intention of introducing this class in java 8 is mainly to check ...

Read More »

Java 8 Collectors API Tutorial With Real Time Examples

A quick practical guide to Java 8’s Collectors api. Example programs on various useful reduction operations and accumulating elements into collections 1. Overview In this tutorial, We’ll be learning to Java 8 Collectors API in-depth with all methods and example programs. Collectors is a public final class that extends Object class. Read this article completely with patience. You will definitely ...

Read More »

Bulk vs Individual Compression

I’d like to share something very brief and very obvious – that compression works better with large amounts of data. That is, if you have to compress 100 sentences you’d better compress them in bulk rather than once sentence at a time. Let me illustrate that: 01 02 03 04 05 06 07 08 09 10 11 12 13 public ...

Read More »

OCR in Java with Tess4J

Optical character recognition (OCR) is the conversion of images containing text to machine-encoded text. A popular tool for this is the open source project Tesseract. Tesseract can be used as standalone application from the command line. Alternatively it can be integrated into applications using its C++ API. For other programming languages various wrapper APIs are available. In this post we ...

Read More »

JDK16 javac xlint Warning about Default Constructors

I mentioned in my blog post “Explicit No-Arguments Constructor Versus Default Constructor” that “it is possible that one day javac will have an available lint warning to point out classes with default constructors.” In that post, I referenced JDK-8071961 (“Add javac lint warning when a default constructor is created”), which has now been implemented as of JDK 16 Early Access ...

Read More »