Skip to content

Tag Archives: Java-HashMap

Given an array arr[] having 4 integer digits only. The task is to return the maximum 24 hour time that can be formed using the… Read More
ArrayList is a part of collection framework and is present in java.util package. It provides us dynamic arrays in Java. Though, it may be slower… Read More
Given an array of distinct elements, the task is to find the total number of two element pairs from the array whose sum is a… Read More
Given an array of N integers, rearrange the array elements such that the next array element is greater than the previous element ( > ).… Read More
Given an array of N integers and a number M. The task is to find out the maximum number of unique integers among all possible… 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
HashSet is implementation of Set Interface which does not allow duplicate value. The main thing is, objects that are stored in HashSet must override equals()… Read More
Given a HashMap and a value in Java, the task is to remove an entry from this HashMap using the value, while iterating over it.… Read More
Given a HashMap and a key in Java, the task is to remove an entry from this HashMap using the key, while iterating over it.… Read More
Given a sequence of integers of even length ‘n’, the task is to find the minimum number of operations required to convert the sequence to… Read More
The compute(Key, BiFunction) method of Hashtable class allows to compute a mapping for the specified key and its current mapped value (or null if there… Read More
The computeIfAbsent(Key, Function) method of HashMap class is used to compute value for a given key using the given mapping function, if key is not… 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
Design a data structure for LRU Cache. It should support the following operations: get and set. get(key) – Get the value (will always be positive)… Read More
HashMap is a part of Java’s collection since Java 1.2. It provides the basic implementation of Map interface of Java which stores the data in… Read More