Java - Medium Articles
Variable A variable is the name given to a memory location. It is the basic unit of storage in a program. The value stored in… Read More
The wait() and join() methods are used to pause the current thread. The wait() is used in with notify() and notifyAll() methods, but join() is… Read More
Friends! I recently appeared for OCA exam and scored 95%. Here i am sharing few techniques and exam question patterns which must be helping you… Read More
Java is a general-purpose, high-level programming language developed by Sun Microsystems. It is concurrent, class-based, object-oriented, and specifically designed to have as few implementation dependencies… Read More
Given a HashMap and a key in Java, the task is to check if this key exists in the HashMap or not. Examples: Input: HashMap:… Read More
Given a HashSet in Java, the task is to sort this HashSet. Examples: Input: HashSet: [Geeks, For, ForGeeks, GeeksforGeeks] Output: [For, ForGeeks, Geeks, GeeksforGeeks] Input:… Read More
Given a Linked List in Java, the task is to convert this LinkedList to Array. Examples: Input: LinkedList: ['G', 'e', 'e', 'k', 's'] Output: Array:… Read More
Prerequisite: ArrayList in Java Given an ArrayList, the task is to get the first and last element of the ArrayList in Java, Examples: Input: ArrayList… Read More
The values() method of SortedMap interface in Java is used to create a collection out of the values of the map. It basically returns a… Read More
The putIfAbsent(Key, value) method of Hashtable class which allows to map a value to a given key if given key is not associated with a… Read More
Given a Stream of Arrays in Java, the task is to Flatten the Stream using forEach() method. Examples: Input: arr[][] = {{ 1, 2 },… Read More
Given a Stream of Map in Java, the task is to Flatten the Stream using forEach() method. Examples: Input: map = {1=[1, 2], 2=[3, 4,… Read More
The compute(Key, BiFunction) method of HashMap class allows you to update a value in HashMap. The compute() method tries to compute a mapping for the… Read More
printStackTrace() The printStackTrace() method of Java.lang.Throwable class used to print this Throwable along with other details like class name and line number where the exception… Read More
The IntUnaryOperator Interface is a part of the java.util.function package which has been introduced since Java 8, to implement functional programming in Java. It represents… Read More
Given a String, the task is to convert it into a List of Characters in Java. Examples: Input: String = "Geeks" Output: [G, e, e,… Read More
The deleteCharAt(int index) method of StringBuilder class remove the character at the given index from String contained by StringBuilder. This method takes index as a… Read More
The List is a child interface of Collection. It is an ordered collection of objects in which duplicate values can be stored. Since List preserves… Read More
The nextLine() method of java.util.Scanner class advances this scanner past the current line and returns the input that was skipped. This function prints the rest… Read More
useDelimiter(Pattern pattern) The useDelimiter(Pattern pattern) method of java.util.Scanner class sets this scanner’s delimiting pattern to the specified pattern. Syntax:  public Scanner useDelimiter(Pattern pattern) Parameter: The… Read More