Posts

Showing posts from June, 2022

NoSQL Database Types

Image
  In this article, excerpted from   Introducing Data Science , we will introduce you to the four big   NoSQL database   types. There are four big NoSQL types: key-value store, document store, column-oriented database, and graph database. Each type solves a problem that can’t be solved with relational databases. Actual implementations are often combinations of these. OrientDB, for example, is a  multi-model database , combining NoSQL types. OrientDB is graph database where each node is a document. Before going into the different NoSQL databases, let’s look at relational databases so you have something to compare them to. In data modelling, many approaches are possible. Relational databases generally strive toward  normalization : making sure every piece of data is stored only once. Normalization marks their structural setup. If, for instance, you want to store data about a person and their hobbies, you can do so with two tables: one about the person and one ...

DIFFERENCE BETWEEN BAGGING AND BOOSTING

Image
 

Spring boot autowiring an interface with multiple implementations

  Solution 1 Use  @Qualifier  annotation is used to differentiate beans of the same interface Take look at Spring Boot  documentation Also, to inject all beans of the same interface, just  autowire   List  of interface (The same way in Spring / Spring Boot / SpringBootTest) Example below: @SpringBootApplication public class DemoApplication { public static void main ( String [] args ) { SpringApplication . run ( DemoApplication . class , args); } public interface MyService { void doWork (); } @Service @Qualifier ( "firstService" ) public static class FirstServiceImpl implements MyService { @Override public void doWork ( ) { System . out . println ( "firstService work" ); } } @Service @Qualifier ( "secondService" ) public static class SecondServiceImpl implements MyService { @Override public void doWork ( ) { System . out . println ( "secondService work" ); } }...

How to Create a Java JAR File and Import Package Libraries into a Java Package

Image
 

Comparator and Comparable in Java

  Comparator Interface in Java with Examples A comparator interface is used to order the objects of user-defined classes. A comparator object is capable of comparing two objects of the same class .  Following function compare obj1 with obj2. Syntax:   public int compare(Object obj1, Object obj2): Suppose we have an Array/ArrayList of our own class type, containing fields like roll no, name, address, DOB, etc, and we need to sort the array based on Roll no or name?   Method 1 : One obvious approach is to write our own sort() function using one of the standard algorithms. This solution requires rewriting the whole sorting code for different criteria like Roll No. and Name. Method 2:  Using comparator interface- Comparator interface is used to order the objects of a user-defined class. This interface is present in java.util package and contains 2 methods compare(Object obj1, Object obj2) and equals(Object element). Using a comparator, we can sort the elements based...