Hello guys, if you want to learn Visitor design pattern in Java then you have come to the right place. Earlier, I have covered many design patterns like Decorator, Strategy, State, Composite, Adapter, Command, Template, Factory, Observer and even few Microservice patterns like SAGA and Database per service and in this article, I will talk about Visitor Design Pattern and how to implement in Java. You will learn things like what is Visitor design pattern, what problem it solves, what are pros and cons of Visitor design pattern, when to use Visitor pattern as well as any alternatives of Visitor Pattern in Java. I will also show you a real world example of Visitor design pattern, but, before we get to the 5 best examples that will teach you all about design patterns in Java, let me tell you a little bit more about what it really is.
Learn Java and Programming through articles, code examples, and tutorials for developers of all levels.
Difference between 32-bit vs 64-bit JVM in Java?
10 Examples Of Mockito + JUnit in Java for Unit Testing
How to convert Java 8 Stream to Array and ArrayList in Java? Example Tutorial
Array length vs ArrayList Size in Java [Example]
How to create an ArrayList from Array in Java? Arrays.asList() Example Tutorial
One of the common problems faced by junior and less experienced Java developers is converting an array to ArrayList e.g. they are getting an array from somewhere in their code and then want to create an ArrayList out of that so that they can add more elements and use other library methods which operate with ArrayList or List. The simplest way to convert an array to ArrayList is by using the Arrays.asList() method, which acts as a bridge between Collection classes and array data structure. This method returns a List that contains elements from an array.
Is it Possible to add static or private methods in Java interface?
10 Examples Of Scanner Class In Java
What is Diamond operator in Java? Example Tutorial
Hello guys, if you are reading Java code and come across closed angle bracket with a diamond like shape and wondering what they are and what they do then you have come to the right place. They are known as Diamond operator in Java and I will explain you what they are and where should you use them in this article. The Diamond operator is a relatively new operator in Java which was first introduced in JDK 7 to improve type inference and reduce boilerplate Java coding. It is denoted with a closed angle bracket that resembles the shape of a diamond (<>) and that's why it's called the Diamond operator. If used correctly it can reduce typing and boilerplate coding in Java and result in much cleaner and readable code especially when you use Generics.
Parallel Array Sorting in Java - Arrays.parallelSort() Example
Difference between Thread vs Process in Java? Example
Difference between yield and wait method in Java? Answer
10 points about wait(), notify() and notifyAll() in Java Thread?
How to run Threads in an Order in Java - Thread.Join() Example
10 Examples Of Lombok Libarary In Java
10 Examples Of Ternary Operator In Java
Hello guys, if you are wondering how to use ternary operator in Java then you have come to the right place. Ternary operator is a great operator and you can use ternary operator to replace a simple if-else statement. Since ternary operator allows you to write code in one line, its much more succinct and readable and that's what many Java developer love it, including me. In the last article, I shared 10 example of XOR bitwise operator in Java and in this article, I am going to share 10 example of ternary operator in Java so that you not only know what is ternary operator but also you can use it effectively to write better Java code. But, before we get to the 10 best examples that will teach you everything there is to know about ternary operators in Java, let me tell you a little bit more about what it all really is.
10 Examples of XOR Operator In Java
How to convert float, double, String, Map, List to Set, Integer, Date in Java - Example Tutorial
Spring HelloWorld Example in Java Annotations and Autowiring [Tutorial]
Top 50 Java Collections + Generics Interview Questions and Answers for 1 to 3 Years Experienced
Difference between HashMap vs IdentityHashMap in Java? Example
How to set the logging level in Spring Boot application.properties - Example Tutorial
Hello guys, if you are wondering how to set the logging level on spring boot then you have come to the right place. In the past, I have shared the best Spring Boot courses and free courses to learn Spring MVC and in this article, I will share how to set logging levels like DEBUG and INFO in Spring Boot. How do we configure the logging level of our Spring boot application is one of the questions that arise when developing a large application. Because we need to trace errors, warnings, informational data when running our application and to this, Spring has introduced Spring boot logging configurations.
How to use @ResponseBody and @RequestBody in Spring MVC and REST? Example Tutorial
How to use lsof command in Linux? Example Tutorial
How to Synchronize HashMap in Java? Collections.synchronizedMap() Example Tutorial
Difference between WeakHashMap , IdentityHashMap, and EnumMap in Java?
Java HashMap keySet() , entrySet and values() Example - Tutorial
What is static and instance Method in Java? Example Tutorial
How to use Lambda Expression and method reference in Java? Example Tutorial
Composite Design Pattern Example in Java and Object Oriented Programming
Hello guys, if you are wondering how to use Composite design pattern in Java then you are at the right place. Composite design pattern is another object oriented design pattern introduced by Gang of Four in there timeless classic book Design pattern : Elements of Reusable software. Composite pattern as name suggest is used to compose similar things together, like similar objects. It implements an interface and also contains other objects which implements the same interface, also known as containee. One of the best example of Composite pattern from Java standard library is Swing's container classes e.g. Panel, which not only are Components by themselves, but also contains other components like JButton, Label, JTable etc.
6 Advanced Comparator and Comparable Examples in Java 8
How to convert String to long in Java? Example
How to convert String to Double in Java and double to String with Example
How to check if two String variables are same in Java? equals(), equalsIgnoreCase() and == operator Example
How to Read User Input and Password in Java from command line? Console Example
How to replace characters and substring in Java? String.replace(), replaceAll() and replaceFirst() Example
5 Difference between Hashtable vs HashMap in Java? Answer
Hashtable and HashMap are two hash-based collections in Java and are used to store objects as key-value pairs. Despite being hash-based and similar in functionality there is a significant difference between Hashtable and HashMap and without understanding those differences if you use Hashtable in place of HashMap then you may run into series of subtle programs which is hard to find and debug. Unlike the Difference between ArrayList and HashMap, Differences between Hashtable and HashMap are more subtle because both are similar kinds of collections. Before seeing the difference between HashMap and Hashtable let's see some common things between HashMap and Hashtable in Java.
How to write a Parameterized Method in Java using Generics? Example
10 Examples of nslookup command in Linux and Windows
Difference between Polymorphism vs Inheritance in Java and Object Oriented Programming - Example
How to convert ArrayList to Comma Separated or Delimited String in Java - Spring Example
10 Examples of head and tail command in Linux
Difference between JDK and JRE in Java Platform
Difference between this and super keywords in Java
10 Examples of more and less command in Linux
How to use String literals in switch case in Java? Example Tutorial
10 Example of SSH Command in UNIX and Linux
10 Examples of wget command in Linux
Hey there! Today's article will explain the "wget" command in Linux and 10 different examples. If you are a Linux user, this is a command you will commonly use almost every now and then.
WHAT IS THE "WGET" COMMAND?
"wget"
is very beneficial in such a way that, If you are downloading a file
and unfortunately the network connection becomes unstable and slow, It
keeps retrying until the file is fully recovered.
Before you can
start using "wget" command, you must have installed that on your Linux.
if not It won't recognize that command if you type it.
10 Examples of netstat command in Linux and UNIX
How to Fix java.lang.ArrayIndexOutOfBoundsException in Java [Solution]
10 Examples of ls command in Linux
10 Reasons of java.lang.NumberFormatException in Java - Solution
3 ways to solve Eclipse - main class not found error
Can You declare Constructor inside Servlet Class in Java? Answer
10 Examples of ps command in Linux
In Today's article, You will be learning about the "ps" command in Linux and our objectives are:
To know what Ps stands for, how it works with numerous options, and provide different examples and the usage of it.
PS stands for processes status. Basically used to list the processes that are running at the moment. As we all know that when a task needs to be implemented it must follow or have a process. There are different options you could use with it and this gives you a different result.
How to fix "variable might not have been initialized" error in Java? Example
[Solved] Error: could not open 'C:\Java\jre8\lib\amd64\jvm.cfg'
Caused By: java.lang.NoClassDefFoundError: org/apache/log4j/Logger in Java [Solution]
Cause : Caused By: java.lang.NoClassDefFoundError: org/apache/log4j/Logger error indicates that JVM is not able to found org.apache.log4j.Logger class in your application's CLASSPATH. The simplest reason for this error is the missing log4j.jar file. Since org.apache.log4j.Logger class belongs to this JAR file, if it's not available at run-time then your program will fail.
How to Avoid/Fix ConcurrentModificationException while looping over ArrayList in Java [Example]
java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlObject [Solved]
'javac' is not recognized as an internal or external command [Solution]
How to Fix java.lang.OufOfMemoryError: Direct Buffer Memory
java.lang.OutOfMemoryError: Java heap space : Cause and Solution
How to fix "class, interface, or enum expected" error in Java? Example
How to fix "illegal start of expression" error in Java? Example
[Solved] java.lang.unsupportedclassversionerror Unsupported major.minor version 55.0, 57.0, 60.0, 61.0 Error in Java? Examples
What is Subquery in SQL? Correlated and Non-Correalted SubQuery Example
Difference between ISNULL() and COALESCE() function in SQL? Example
Difference between table scan, index scan, and index seek in SQL Server Database? Example
How to find Nth Highest Salary in MySQL and SQL Server? Example LeetCode Solution
---------------------------------------------------------------
Write a SQL query to get the nth highest salary from the Employee table.
+----+--------+
| Id | Salary |
+----+--------+
| 1 | 100 |
| 2 | 200 |
| 3 | 300 |
+----+--------+
For example, given the above Employee table, the nth highest salary where n = 2 is 200. If there is no nth highest salary, then the query should return null.
10 Examples of df Command in Linux and UNIX
What does df mean?
The meaning of df in Linux is disk-free or disk file system. Which is used to display the file system in the likes of total storage space, available storage space and etc.
Df command in Linux is a command or syntax in Linux that you doing away with it is almost impossible
You may begin to wonder or ask Why or When do You need to use it?
How to use recursive grep command in Linux and UNIX? grep -iR Example tutorial
Difference between Soft Link vs Hard Links in Linux/UNIX? Answer
6 Linux command Examples and One liners Every Programmer Should Remember
How to Find large Files and Directories with size in Linux and UNIX? find + du command Example Tutorial
How to send Email with Body and Attachment from Linux Machine? mutt and mailx command Example
How to set JAVA_HOME and PATH in Linux? Example
How to backup and load Cron Jobs from a File in Linux and UNIX? Crontab Command Example
How to find swap space and usage in Solaris? Swap Command Example
How to send Logging Messages to SysLog using Log4j2 SysLogAppender in Linux ? Java Example
5 Ways to implement Singleton Design Pattern in Java? Examples
How to use Strategy Design Pattern in Java? Example Tutorial
10 Examples Of du Command in Linux
Here, we shall be looking at another command in Linux. The” du” command. Before giving the examples you can use with it I will be explaining the du itself, What is being used for and When to use it, and How to use it
So Firstly, What is DU or What does the command mean?
The full meaning of du is Disk usage. This helps in planning and maintaining the file’s space. The command is used to keep track of any files or directories that are taking up too many spaces in the hard disk drive. Now we shall be taking the examples one after the other.
3 Examples of for loop in Linux and Bash Script [Tutorial]
10 ways to Quit/Exit from Vim Editor in Linux/UNIX? Examples
10 Example of ps -ef command in Linux and UNIX
10 Examples of df Command in Linux
Hello, In Today’s article we shall be talking about the df command in Linux. The objectives of this article are: What is the df command, and what does it mean? How is it used? I shall be providing 10 different examples or scenarios for it and when to use it
What does df mean?
The meaning of df in Linux is disk-free or disk file system. Which is used to display the file system in the likes of total storage space, available storage space and etc.
Df command in Linux is a command or syntax in Linux that you doing away with it is almost impossible
You may begin to wonder or ask Why or When do You need to use it?