## PlantUML: Composite State In State Diagram

2024-01-28 15:12
A state can be composite (State can hold multiple other states). compositeState.txt@startuml state compositeState1 { state subState1 { state s1 state s2 } state subState2 } state… Read More

## Hive: Hex(n): Return Hexa Value Of This Number

2022-11-07 04:46
Signaturehex(n)hive> SELECT * FROM emp;OKemp.id emp.name emp.hobbies emp.technology_experience emp.gender_age emp.rating1 Hari ["Football","Cricket"] {"Java":"3.4Yrs","C":"4.5Yrs"} {"gend… Read More

## Hive: Exp: Return E To The Power N

2022-11-04 05:05
Signatureexp(n)hive> SELECT * FROM emp;OKemp.id emp.name emp.hobbies emp.technology_experience emp.gender_age emp.rating1 Hari ["Football","Cricket"] {"Java":"3.4Yrs","C":"4.5Yrs"} {"gend… Read More

## Hive: Cos: Return Cosine Of The Value

2022-11-02 04:18
Signaturecos(n)hive> SELECT * FROM emp;OKemp.id emp.name emp.hobbies emp.technology_experience emp.gender_age emp.rating1 Hari ["Football","Cricket"] {"Java":"3.4Yrs","C":"4.5Yrs"} {"gend… Read More

## Hive: Conv: Convert Number From One Base To Other Base

2022-11-01 04:37
Signatureconv( bigint n, int from_base, int to_base )hive> SELECT * FROM emp;OKemp.id emp.name emp.hobbies emp.technology_experience emp.gender_age emp.rating1 Hari ["Football","Cricket"]… Read More

## Hive: Ceil, Ceiling: Return Ceiling Value Of N

2022-10-31 07:18
Signatureceil(n)ceiling(n) 'ceil' function return the smallest integer value that is greater than or equal to this number.hive> SELECT * FROM emp;OKemp.id emp.name emp.hobbies emp.te… Read More

## Hive: Bin: Return Number In Binary Format

2022-10-21 05:42
Signaturebin(n)hive> SELECT * FROM emp;OKemp.id emp.name emp.hobbies emp.technology_experience emp.gender_age emp.rating1 Hari ["Football","Cricket"] {"Java":"3.4Yrs","C":"4.5Yrs"} {"gend… Read More

## Java.util.Date Vs Java.sql.Date

2022-09-10 07:14
java.util.Date ‘java.util.Date’ class is used to represent a specific instant in time, with millisecond precision since the 1st of January 1970 00:00:00 GMT (the epoch time). &nb&hell…Read More

## Quick Guide To Assertions In Java

2022-09-09 05:43
In this post, I am going to explain about the assert statement in Java with the help of examples.   Assertions were added in Java1.4, that enables you to test the assumptions about your… Read More

## Atlas Client: Get The Glossary By Guid

2022-09-09 05:29
AtlasClientV2#getGlossaryByGuid method is used to get the glossary by guid.   Signaturepublic AtlasGlossary getGlossaryByGuid(String glossaryGuid) throws AtlasServiceException… Read More

## Hive: Degrees(n): Convert Radians To Degrees

2022-09-09 05:19
Signature degrees(n)hive> SELECT degrees(90);OK_c05156.620156177409Time taken: 0.05 seconds, Fetched: 1 row(s)    Previous        … Read More

## JanusGraph: Get All The Outgoing Edges Of Vertex

2022-02-02 09:45
By supplying Direction.OUT argument to the edges method, we can get all the outgoing edges of a vertex.   public Iterator edges(final Direction direction, final String... edgeLabels); G… Read More

2021-10-25 10:33

## ArangoDB: Drop A Collection

2021-09-27 03:42
ArangoCollection interface provides 'drop' method to drop a collection.   void drop() throws ArangoDBException; Drop a collection.   void drop(boolean isSystem) throws ArangoDBExce… Read More

## ArangoDB: Get The Collection By Name

2021-09-25 04:33
ArangoDatabase interface provides 'collection' method which takes a collection name as argument and return ArangoCollection.   ExampleArangoCollection arangoCollection = arangoDatabase… Read More

## ArangoDB: AQL: Insert A Document Into The Collection

2021-09-09 07:40
SyntaxINSERT document INTO collectionName  Example INSERT { "id" : 1, "firstName" : "Krishna", "lastName" : "Gurram"} INTO users Above sni… Read More

## AQL Using ArangoDB Web UI

2021-09-09 07:40
In upcoming posts, I am going to explain how to execute AQL queries using Arango Web UI.   Let’s create a collection ‘users’ using ArangoDB web ui.   Step 1: Logi… Read More

## ArangoDB: AQL: Insert Multiple Documents

2021-09-07 08:41
SyntaxFOR doc IN array_of_documents INSERT doc INTO colleciton_name  Example let users_info = [ {"id": 2, "firstName" : "Sowmya", "lastName" : "Gurram"}, {… Read More

## Junit5: TestInfo: Get Information About The Test

2021-08-20 07:23
TestInfo class is used to inject information about the current test or container into a @Test, @RepeatedTest, @ParameterizedTest,  @TestFactory, @BeforeEach, @AfterEach, @BeforeAll, and… Read More

## Junit5: RepetitionInfo: Retrieve Information About Current Repetition

2021-08-20 07:22
If a method parameter in a @RepeatedTest, @BeforeEach, or @AfterEach method is of type RepetitionInfo, the RepetitionInfoParameterResolver will supply an instance of RepetitionInfo. Repetiti… Read More

## Junit5: TestReporterParameterResolver: Get Data About Current Test Run

2021-08-20 07:20
If a constructor or method parameter is of type TestReporter, the TestReporterParameterResolver will supply an instance of TestReporter. The TestReporter can be used to publish additional da… Read More

## Bean Validation: Email: Validate Email

2021-03-31 03:57
If you annotate @Email annotation on top of CharSequence, then the CharSequence should be a well-formed email address.   Example @Email public String emailId;   What are the suppor… Read More

## Bean Validation: Digits: Number Must Be Within Accepted Range

2021-03-30 05:52
If you add @Digits annotation on any number, then the number must be within accepted range.   Example @Digits(integer = 9, fraction = 2) private double salary;… Read More

## Bean Validation: DecimalMin: Value Must Be >= This Value

2021-03-29 04:09
If you annotate any number with @DecimalMin annotation, then the number must be higher or equal to the specified minimum.   Example @DecimalMin(value = "500") p… Read More

## Bean Validation: @DecimalMax: Value Must Be

2021-03-24 15:30
If you apply @DecimalMax annotation on a number, then the number must be lower or equal to the specified maximum.   Example @DecimalMax(value = "100000") privat… Read More

## Bean Validation: @AssertFalse: Validate Falsity Of The Element

2021-03-24 15:11
If you annotate any element with @AssertFalse annotation, then the annotated element must be false.   Example @AssertFalse private boolean isExperienced;   Supported Types a. … Read More

## Bean Validation: Built-in Constraints

2021-03-17 15:17
'javax.validation.constraints' package provides number of annotations to do validations on data.   Below table summarizes the annotations provided by JSR-380 sp… Read More

## Setting Up Environment For Hibernate-validator

2021-03-15 04:49
I am going to use Hibernate validator '6.0.10.Final'. dependency>groupId>org.hibernategroupId>artifactId>hibernate-validatorartifactId>version>6.0.10.Finalversion>depen… Read More

## Hibernate-validator: Hello World Application

2021-03-15 04:48
In this post, I am going to show you an example of bean validation API annotations @Min, @Size.   JSR 380 specification provides @Min, @Size annotation to validate the bean properties… Read More

## ProvideSystemProperty: Provide System Properties

2021-02-21 07:13
ProvideSystemProperty rule is used to set an arbitrary value to given system property. After the test the original value is restored.   Example@Rulepublic final ProvideSystemProperty CO… Read More

## JavaFX Tutorial

2021-01-06 04:58
JavaFX JavaFX BasicsJavaFX is a high performance graphical user interface library provided by java. It is used to build platform independent, rich UI client applications. Read more… Read More

## JavaFX: TableView Widget

2020-12-28 06:49
TableView class is used to define a table view control. TableView represent the data in rows and columns.   Is TableView scrollable? Yes   Is TableView editable? Yes   TableCo… Read More

## Python: Get List Of Numbers Using Range Function

2020-12-21 06:59
We can convert the output of range() function to a list using ‘list()’ function.   Example list(range(1, 10))>>> list1 = list(range(1, 10))>>> >>>… Read More

## Python: Get Minimum Element From List Of Elements

2020-12-21 06:57
‘min()’ function takes a list as argument and return minimum element from list of elements.   Get minimum number from list of numbers>>> list1 = [2, 4, 1, -9, 89, … Read More

## JavaFX: ListView

2020-12-18 16:02
ListView displays a horizontal or vertical list of items from which the user may select, or with which the user may interact. A ListView is able to have its generic… Read More

## JavaFX: ToolBar Control

2020-12-15 16:03
ToolBar control is used to display items horizontally or vertically.   Example ToolBar toolBar = new ToolBar(); toolBar.getItems().addAll(copyButton, cutButton, pastButton, undoButton… Read More

2020-12-15 16:02

2020-12-15 15:55
Hyperlink widget is used to create hyper link controls. Hyperlink can be a graphic and/or text which responds to rollovers and clicks. Hyperlinks are underlined, whe… Read More

## JavaFX: TextField Widget

2020-12-05 02:37
TextField class is used to create a TextField widget.   Can a TextField has support to multi line input? No, TextField support single line input. If you want multi line support, you sho… Read More

## JavaFX: BorderPane

2020-11-12 06:03
BorderPane lays out children in top, left, right, bottom, and center positions.   a.   The top and bottom children will be resized to their preferred heights and extend the wi… Read More

## JavaFX: Anchor Pane

2020-11-12 06:02
AnchorPane allows the edges of child nodes to be anchored to an offset from the anchor pane's edges.  If the anchor pane has a border and/or padding set, the offsets will be measured fr… Read More

## JavaFX: StackPane

2020-11-12 05:24
StackPane layout place UI components in a single stack. The z-order of the children is defined by the order of the children list with the 0th child being the bottom and last child on top.&nb&hell…Read More

## JavaFX: Create Chain Of Effects

2020-11-07 15:14
Output of one effect can be set as input to other effect. Using this chaining, we can apply multiple effects to the node.   In this post, I am going to apply reflection affect as input… Read More

## JavaFX: PerspectiveTransform Effect

2020-11-07 15:14
This effect is used to provide 3D effect for 2D content by creating a perspective in Z-axis direction.   A perspective transformation is capable of mapping an arbitrary quadrilateral in… Read More

## JavaFX: SepiaTone Effect

2020-11-05 20:48
SepiaTone class is used to produces a sepia tone effect, similar to antique photographs.   ‘SepiaTone’ class provides following constructors to get an instance of SepiaTone… Read More

## JavaFX: DisplacementMap Effect

2020-11-05 20:47
DisplacementMap effect shifts each pixel by a distance specified by the first two bands of of the specified FloatMap.   What is FloatMap? FloatMap is a buffer t… Read More

## JavaFx: Reflections

2020-11-05 20:43
Reflection effect renders a reflected version of the input below the actual input content.   Reflection class provides following constructors to define Reflection instance.  … Read More

## JavaFX: ColorInput Effect

2020-11-05 20:39
ColorInput effect is used to render a rectangular region that is filled with the given color.   ColorInput serves as an effect to other effect instance.   house.png  … Read More

## JavaFX: Lighting

2020-11-04 18:53
The lighting effect simulates a light source shining on the given content, which can be used to give flat objects a more realistic three-dimensional appearance.   Why… Read More

2020-11-04 18:53

## JavaFX: Glow Effect

2020-11-04 18:50
Glow is a high-level effect that makes the input image appear to glow, based on a configurable threshold.   Glow class provides following constructors to get an instance of Glow.  … Read More

## JavaFX: Bloom Effect: Make The Portion Of Image Brighter

2020-11-04 18:44
The bloom effect makes portions of an image appear to glow, based on a configurable threshold.   Bloom class provides following constructors to define Bloom instance. public Bloom() pu… Read More

## JavaFX: Hello World Application

2020-10-20 10:48
Step 1: Extend 'javafx.application.Application' class and override start method.public class HelloWorld extends Application {@Overridepublic void start(Stage primarySt… Read More

## Introduction To JavaFX

2020-10-20 10:37
Why JavaFX? a.   Rich Client Platform with lot of features to develop rich desktop clients. b.   Rich UI controls like buttons, text boxes, check… Read More

## Scala: Functions

2020-09-22 06:10
Functions are first class citizens in Scala. ‘sum’ function takes two integer arguments and return the sum of two variables.scala> def sum(a: Int, b : Int) = a + bdef sum(a: I… Read More

## Can A Constructor In Java Is Private?

2020-03-23 10:05
Yes, a constructor can be private in Java.Possible Scenariosa. A class with all static methods.Suppose you define an utility class with all static methods, then there is no point of creating… Read More

## Spring Boot: @Value: Populate List From A Property

2020-03-23 09:54
Suppose you have comma separated values like below.supportedVersions=0.5,0.7,0.9You can populate a list from the property 'supportedVersions' using Spring EL (Expression Language).@Value("#{… Read More

## Swagger: Tagging The APIs

2020-03-23 09:43
Tags are used to group the APIs. Tags are created using ‘tags’ element.Examplepaths: /employees/{employeeId}: get: tags: - single - getdata.yamlopenapi: 3… Read More

## Swagger UI: Generate Interactive Documentation From API Definition File

2020-03-23 09:43
Step 1: Create API definition fileemployees.yamlopenapi: 3.0.0info: title: Customer Data Aceess API description: API to expose all the CRUD operations on customers contact: name: Kris… Read More

## How To Get Original Hash Code Of The Object?

2020-02-11 15:46
Suppose you are given an Employee class, which overrides hashCode method. Now the question is ‘How will you get the original hash code of the object?’AnswerUse the method 'identi… Read More

## Cassandra: Delete All The Rows From A Table

2020-02-08 02:37
Using ‘TRUNCATE’ command, you can delete all the rows from a table.Syntax: ::= TRUNCATE ( TABLE | COLUMNFAMILY )? Example:TRUNCATE keyspaceName.tableName;If you are already in th… Read More

## Cassandra: DELETE: Delete A Row Or Column From Table

2020-02-08 02:37
You can delete a row from cassandra table using 'DELETE FROM' statement.Syntax:delete-stmt> ::= DELETE ( ( ',' )* )?FROM ( USING TIMESTAMP integer>)?WHERE where-cla… Read More

## Jackson: @JsonManagedReference, @JsonBackReference Example

2020-02-01 10:39
In this post, I am going to explain how to handle bidirectional relationships using Jackson @JsonManagedReference, @JsonBackReference annotations. Let’s take an example of simple one… Read More

## Convert US_ASCII Byte Array To String

2020-02-01 10:28
Following snippet converts US_ASCII byte array to string.byte[] byteArr = {72,101,108,108,111,32,87,111,114,108,100};String str = new String(byteArr, StandardCharsets.US_ASCII); App.javapac… Read More

## Cassandra: Aliases In SELECT Statements

2020-02-01 10:25
CQL support aliases in SELECT statement using AS keyword.Examplecqlsh> SELECT * FROM cassandratutorial.employee; id | age | firstname | lastname----+-----+-----------+---------- 1 | 3… Read More

## What Is The Default Value Of Boolean Field?

2020-01-23 16:32
The default value for a Boolean (or any object) field is null.The default value for a boolean (primitive) field is false.DemoClass.javapackage com.sample.app;public class DemoClass {boolea… Read More

## Cassandra: Get Information Of Specific Table

2020-01-23 16:16
‘DESCRIBE TABLE tableName’ or ‘DESC TABLE tableName’ gives you the information about a table.cqlsh> DESCRIBE KEYSPACES;system_schema system system_d… Read More

## Remove Elements Of Map While Iterating?

2020-01-20 14:23
Approach 1: Using iteratorIterator> iterator = map.entrySet().iterator();while (iterator.hasNext()) { iterator.remove();} Read More

## Cassandra: Create A Table

2020-01-20 14:18
You can create a table using ‘CREATE TABLE’ command.SyntaxCREATE TABLE [IF NOT EXISTS] [keyspace_name.]table_name ( column_definition [, ...] PRIMARY KEY (column_name [, c… Read More

## How To Get The Content Type Of A List?

2020-01-19 14:16
Below snippet prints generic type of a field.public static void printGenericType(Field field) { ParameterizedType genericType = (ParameterizedType) field.getGenericType();int lengthOfArgum… Read More

## How To Get Key Type Of Map In Java?

2020-01-19 14:06
Below snippet prints generic type of a field.public static void printGenericType(Field field) { ParameterizedType genericType = (ParameterizedType) field.getGenericType();int lengthOfArgum… Read More

## Cassandra: Alter Keyspace: Change Keyspace Replication Strategy

2020-01-19 14:01
You can change the replication strategy of the keyspace using ‘ALTER KEYSPACE’ command. SyntaxALTER KEYSPACE keyspace_name WITH REPLICATION = { 'class' : 'SimpleStrate… Read More

## Cassandra: List All The Keyspaces In Cassandra Cluster

2020-01-19 14:00
Approach 1: DESCRIBE keyspaces;Approach 2: SELECT * FROM system_schema.keyspaces;cqlsh> DESCRIBE KEYSPACES;system_schema system_auth system system_distributed system_tracescqlsh>… Read More

## How To Get Value Type Of Map In Java?

2020-01-13 08:48
Below snippet prints generic type of a field.public static void printGenericType(Field field) { ParameterizedType genericType = (ParameterizedType) field.getGenericType();int lengthOfArgum… Read More

## How To Get Generic Types Of Map In Java?

2020-01-13 08:43
Below snippet prints generic type of a field.public static void printGenericType(Field field) { ParameterizedType genericType = (ParameterizedType) field.getGenericType();int lengthOfArgum… Read More

## How To Convert Int[] To Integer[] In Java?

2020-01-02 14:33
Approach 1: Traversing to each element and convert.public static Integer[] getBoxedArray_approach1(int[] arr) {if (arr == null)return null; Integer[] result = new Integer[arr.length];int i… Read More

## Sort Array In Descending Order

2020-01-02 14:29
‘Arrays.sort’ function is used to sort array elements in descending order.ExampleInteger[] arr = { 1, 3, 5, 7, 2, 4, 6, 8, 10 };Arrays.sort(arr, Collections.reverseOrder());App… Read More

## Sort An Array In Ascending Order

2020-01-02 14:25
Following statement sorts the array in ascending order.Arrays.sort(arr);App.javapackage com.sample.app;import java.io.IOException;import java.util.Arrays;public class App {private static v… Read More

## Java: Read File Content As String

2020-01-02 14:05
Approach 1: Using ScannerString content = new Scanner(new File(filePath)).useDelimiter("\\Z").next();Approach 2: Using Files.readAllBytes.String content = new String(Files.readAllBytes(Paths… Read More

## Spring Boot Jpa: Contains Query Method Example

2019-12-23 08:00
Below snippet return all the employees whose name contains given string.// SELECT * FROM employee WHERE firstName LIKE %:nameStartWith%public List findByFirstNameContaining(String str);Find… Read More

## Spring Data Jpa: Prefix Query Method

2019-12-23 07:55
Following query method return all the employees whose firstName starts with given string.// SELECT * FROM employee WHERE firstName LIKE :nameStartWith%public List findByFirstNameStartingWith… Read More

## Spring Boot Jpa: Suffix Query Method

2019-12-23 07:45
Following method return all the employee details whose firstName ends with given string.// SELECT * FROM employee WHERE firstName LIKE %:nameEndWithpublic List findByFirstNameEndingWith(St… Read More

## Spring Boot REST: Customize Json Response Properties

2019-08-05 16:27
You can customize the json response payload properties using '@JsonProperty' annotation.Examplepublic class Employee {@JsonProperty("employee_id")private int id;@JsonProperty("first_name")… Read More

## Spring Boot REST: Ordering The Response Payload

2019-08-05 16:26
@JsonPropertyOrder annotation is used to specify the order of entity properties while serializing.Example@JsonPropertyOrder({"last_name", "first_name", "employee_id"})public class Employee… Read More

## Spring REST: Map POST Payload To An Entity

2019-08-05 16:15
‘@RequestBody’ annotation maps request payload to given objectIn the bleow example, @RequestBody annotation maps request payload to Employee object.@RequestMapping(value… Read More

2019-08-05 16:04

## Spring Boot REST: Hello World Application

2019-08-04 15:27
Below snippet creates simple REST endpoint to home page.@RestControllerpublic class HomeController {    @RequestMapping("/")    public String home() { &n&hellip…Read More

## Spring Boot REST: Send Json Response Of An Object

2019-08-04 15:26
Spring boot has default support for JSON payload. For example, below snippet return all the employees data in json format.@RequestMapping(value = "employees", method = RequestMethod.GET)pu… Read More

2019-08-04 15:19

## Spring Boot: Adding Interceptor To Spring Boot Application

2019-08-04 15:01
This is continuation to my previous post. You can download previous working application from this link.Step 1: Create interceptor class. PerformanceReportInterceptor.javapackage com.sample… Read More

## Spring Boot: Testing Controller Or REST APIs

2019-08-04 03:33
This is continuation to my previous post. In my previous post, I explained how to test service layer.You can download previous working application from this link.In this post, I am going t… Read More

## Spring Boot: Redirecting To View (jsp File) From Controller

2019-08-04 03:32
This is continuation to my previous post. You can download previous working application from this link.Step 1: Create ‘webapp’ folder under src/main of maven project.Right clic… Read More

## Spring Boot: Writing Integration Tests To Service Layer

2019-08-04 03:25
In my previous post, I explained how to write unit tests. In this post, I am going to explain how to write integration tests to service layer.This is continuation to my previous post, You… Read More

## Spring Boot: Application.properties

2019-08-03 16:27
This is continuation to my previous post, you can download previous application from below github link.Spring boot comes with default configurations.For example, when I add ‘spring-b… Read More

## Spring Boot: Working With Different Environments

2019-08-03 16:26
Any non-trivial application runs at least in three different environments.a.   Developmentb.   Testingc.    ProductionDepend on the type of environment… Read More

## Spring Boot: RestEntity: Enhancing Rest Application

2019-08-03 15:37
In my previous post, I explained simple REST application. You can download previous working application from this link.Areas of improvementa.   We are not done any validations wh… Read More

## Spring Boot: Adding Rest APIs

2019-08-03 15:32
This is continuation to my previous post. In this post, I am going to explain how to add rest end points to the previous application.You can download the previous working application from… Read More

## Introduction To Debug Package

2019-08-01 15:09
'debug' is a tiny JavaScript debugging utility.Install debug packageStep 1: Create a folder ‘debugDemo’Step 2: Go inside ‘debugDemo’ folder and execute the command… Read More

## How To Debug Node.js Application?

2019-08-01 14:43
In this post, I am going to show you how to debug a node.js application using chrome development tools.Create a node.js application like below.HelloWorld.js//Load express moduleconst expre… Read More

## Body-parser Tutorial

2019-08-01 14:38
Introduction to body-parser      Express: body-parser: hello World applicationPrevious      … Read More

# Share the post

java tutorial : Blog to learn java programming

×