What are the advantages of Modules in Java 9?

raja
Published on 08-Apr-2020 17:30:52
A module is a container of packages designed for reuse, and each module contains a module descriptor that includes the information about module name, module dependencies (name of the other modules which it depends on) and name of the packages it exports that can be used only by modules which depend on it.Advantages ... Read More

How to save the current JShell session in Java 9?

raja
Published on 08-Apr-2020 16:05:07
Java 9 has introduced a new feature is the creation of a REPL (Read-Evaluate-Print-Loop) called JShell. It is a command-line prompt tool to evaluate Java code without the need to write a complete program.When we can enter code or internal commands in JShell, we need to use it during the current ... Read More

How to Set/modify the pixels(RGB values) of an image using Java OpenCV Library?

Krishna Kasyap
Published on 08-Apr-2020 13:43:14
A pixel is the smallest element of a digital image, each pixel contains the values of alpha, red, green, blue values. The pixel value(s) is stored in a 32-bit memory space holding ARGB values (8 bits each) in the same order. Therefore, to modify the color of an image −You ... Read More

How to perform Bitwise OR operation on two images using Java OpenCV?

Krishna Kasyap
Published on 08-Apr-2020 13:40:03
You can compute bitwise or between two images using the bitwise_or() method of the org.opencv.core.Core class.This method accepts three Mat objects representing the source, destination and result matrices, calculates the bitwise disjunction of each element in the source matrices and stores the result in the destination matrix.ExampleIn the following Java example, ... Read More

How to list all the Collections in a MongoDB database using Java?

Krishna Kasyap
Published on 08-Apr-2020 13:28:26
You can print a list of all the existing collections in a database using show collections.ExampleAssume we have created 3 collections in a MongoDB database as shown below −> use sampleDatabase switched to db sampleDatabase > db.createCollection("students") { "ok" : 1 } > db.createCollection("teachers") { "ok" : 1 } > ... Read More

Reference to a constructor using method references in Java8

Krishna Kasyap
Published on 08-Apr-2020 13:24:20
Lambda expressions In Java allows you to pass functionality as an argument to a method. You can also call an existing method using lambda expressions.list.forEach(n -> System.out.println(n));Method references are simple, easy-to-read lambda expressions to call/refer and the existing method by name in a lambda expression. In addition to the instance ... Read More

Reference to an instance method using method references in Java8

Krishna Kasyap
Published on 08-Apr-2020 13:22:41
Lambda expressions In Java allows you to pass functionality as an argument to a method. You can also call an existing method using lambda expressions.list.forEach(n -> System.out.println(n));Method references are simple, easy-to-read lambda expressions to call/refer and existing method by name in a lambda expression.SyntaxFollowing is the syntax to reference a ... Read More

Reference to a static method using method references in Java8

Krishna Kasyap
Published on 08-Apr-2020 13:19:42
Lambda expressions In Java allows you to pass functionality as an argument to a method. You can also call an existing method using lambda expressions.list.forEach(n -> System.out.println(n));Method references are simple, easy-to-read lambda expressions to call/refer and the existing method by name in a lambda expression. You can refer to a ... Read More

What are method references in Java8?

Krishna Kasyap
Published on 08-Apr-2020 13:16:45
Lambda expressions In Java allows you to pass functionality as an argument to a method. You can also call an existing method using lambda expressions.list.forEach(n -> System.out.println(n));Method references are simple, easy-to-read lambda expressions to call/refer and the existing method by name in a lambda expression.SyntaxObject:methodNameExampleSuppose, if we have an interface ... Read More

How to convert a colored image to blue/green/red image using Java OpenCV library?

Krishna Kasyap
Published on 08-Apr-2020 13:15:20
The cvtColor() method of the Imgproc class changes/converts the color of the image from one to another. This method accepts three parameters −src − A Matrix object representing source.dst − A Matrix object representing the destination.code − An integer value representing the color of the destination image.To convert a colored ... Read More
1 2 3 4 5 6 7 ... 3397 Next
Advertisements