Home » Java » Page 50

Java

RESTful services with HATEOAS. Documenting Hypermedia APIs

java-interview-questions-answers

1. Introduction Hopefully the previous part of the tutorial not only unveiled the far-reaching implications of the hypermedia and HATEOAS but has truly convinced us that these are among the fundamental building blocks of the RESTful web services and APIs. In this part we are going to continue this theme with the focus on the documentation aspect in order to ...

Read More »

Mockito ‘thenReturn’ vs Mockito ‘thenAnswer’

When it comes to writing test cases for code, Mockito is one of the most common choices of developers. Then we face the question, how to use thenReturn() and thenAnswer() methods of Mockito? If you are facing this also, don’t worry every one faces or has faced this question and we are here to solve it!! So, get set go… ...

Read More »

Looking at Java Records

JEP 359, available as preview feature in JDK 14, introduces records to Java. Records are an easy way to model plain data aggregates. A simple Range record looks like this: 1 record Range(int from, int to) {} A record definition is literally the same as a final class with: immutable fieldspublic accessorsa constructorimplementations for equals(), hashCode() and toString() So we ...

Read More »

JMetro Version 8.6.11 And 11.6.11 Released

Hi. Another release of JMetro. This time 2 new control have been restyled, bug fixes and other small tweaks. I hope you are all staying safe and well in this strange times. Keep on reading for details. New ColorPicker Style Following is an animation of the new ColorPicker style LIGHT and DARK: ColorPicker JMetro Light style ColorPicker JMetro Dark style ...

Read More »

Java puzzlers from OCA part 7

In this part of the Java Puzzlers from OCA series, I will show multiple ways of defining Strings and potential surprises related to that. Two basic types of creating Strings are creation with new keyword, and by just using the string literal. 1 2 String strWithNew = new String("hey"); String strWithLiteral = "ho"; As Strings are frequently used JVM uses ...

Read More »

A Java XMPP Load Test Tool

In this article, we will develop an XMPP Load Test Tool written in Java. Table Of Contents 1. Introduction 2. XMPP Load Test tools 3. Prerequisites 4. LoadXmppTest Java program 4.1. Create a new Maven project 4.2. Create the main class 4.3. XmppManager class 4.4. Build 4.5. Load test 5. Summary 6. References 7. Download the Maven project   1. ...

Read More »

How to convert Array to List in Java

Hello Friends, In this tutorial, we will learn, various ways in which we can convert an array to a List. package com.blogspot.javasolutionsguide; import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.stream.Collectors; import java.util.stream.IntStream; import java.util.stream.Stream; public class ArrayToList { public static void main(String[] args) { //Before Java 8 System.out.println("Before JAVA 8........................................"); // 1. ...

Read More »

Spring Boot and Micrometer with Prometheus Part 5: Spinning up prometheus

spring-interview-questions-answers

Previously we got our Spring Boot Application adapter in order to expose the endpoints for prometheus.This blog will focus on setting up prometheus and configure it in order to server the Spring Boot Endpoints.So let’s get started by spinning up the prometheus server using docker. Before proceeding on spinning up prometheus we need to supply a configuration file to pull ...

Read More »