Filter
Exclude
Time range
-
Near
Replying to @SumitM_X
Class.forname() - loads a class at runtime using class's name, Thread.yield() - acts as hint for jvm to run other threads new String("").intern() - Puts the string into the String Pool and returns the pooled reference. very imp questions in terms of interview map.entrySet() - It returns a Set view of all the key-value mappings (known as Map.Entry objects). entrySet() shoudl be preferred to use when both key and value are needed. object.wait() - current thread releases lock on object's monitor and enter waiting state Thread.join() - Makes one thread wait until another finishes. Coomonly used by mainthread to wait for worker threads. stream().flatMap() - Flattens nested streams into one stream.
13
503
[36/100] 2190. Most Frequent Number Following Key In an Array . Scanned adjacent pairs, tracked frequencies with HashMap, then traversed entrySet() to find the max. Simple logic, linear time. #LeetCode #DSA #Java #CodingJourney
3
112
Day 20/365: More HashMap Learning Topic: HashMap's Today's Progression: • HashMap Basics: Moved from for loops to keySet() & entrySet() iterations. Learned that Maps have no "order"—they only have Keys. • First Non-Repeating Element: Solved the classic "Two-Pass" problem. (Pass 1: Build Count, pass 2: Verify Order). • Intersection & Union: used HashSet as a filter. Intersection: "Check and Cross off" (contains remove). Union: "Just Add Everything" (Set automatically handles duplicates). Revision Java Streams: • Q_10_Find_Duplicates_in_List • Q_11_Merge_Multiple_List_in_list • Q_12_Concatenate_multiple_string_words #DSA #Java #CodingStreak #100DaysOfCode #DataStructures #HashMap #InterviewPreparation #BuildInPublic #Java8 #JavaStreams #RevisionMode
1
2
42
Day 19/365: Return to First Principles – HashMap Learning Sliding Window in Java HashMap deep dive: •Creation/printing (null keys handled) •Iterations: KeySet, EntrySet, Iterator •Frequency counting: getOrDefault put magic Array Problems: •Applied: Josephus Problem (circular elimination binary survivor trick) •Max Consecutive Ones II (LC variant: at most 1 flip → O(N) window) •Streams revision: sum list, toLowerCase, filter matching strings Patterns clicking better daily! #DSA #Java #CodingStreak #100DaysOfCode #HashMap #SlidingWindow #Java8 #BuildInPublic #InterviewPrep
1
2
58
Various ways to iterate over Collections in Java ✅ Basic Loops👉 Traditional indexed for loops work for indexed collections like List and arrays by using size() or length and get(index). While loops pair with iterators via hasNext() and next(). These approaches allow index access or safe removal during iteration.​ Enhanced For-Each👉 The enhanced for loop (for-each), introduced in Java 5, simplifies iteration over any Iterable or array without explicit indexing: for (Type item : collection) { ... }. It suits read-only traversal of List, Set, or arrays cleanly.​ Iterator and forEach👉 Explicit Iterator from iterator() enables fail-fast iteration and removal: while (it.hasNext()) { it. next(); }. Java 8's forEach(Consumer) method processes each element concisely, like list.forEach(System.out::println);, on List, Set, or Map views.​ Streams API👉 Java 8 Streams provide functional iteration: collection. stream().forEach(...) or with operations like filter/map: stream().filter(...).forEach(...). Use parallelStream() for concurrency on large collections.​ Map Iteration 👉 For Maps, iterate entries via entrySet(): for (Map.Entry<K,V> e : map.entrySet()) { ... }, keys with keySet(), or values with values(). Streams work similarly: map.entrySet().stream().forEach(...)
1
4
44
1,637
🌟2025.03.01 💡やったこと 《自主学習》Javaの理解(paiza) 計: 1時間00分 ✍️感想 Java入門編、引き続きHashMapのチャプター、基本操作までは良かったが、ループで処理してみよう!が苦しかった!そもそも拡張forの理解も浅いことが浮き彫りとなった!エントリーって何だよ?💦entrySet()は何だよ?💦ってなって時間がかかった💦 #RaiseTech #BuildUpDaily
4
80
HASH MAP: Definition: HashMap is a data structure that stores key-value pairs. 2. Package: Part of java.util. 3. Keys: Must be unique; one null key allowed. 4. Values: Can be duplicate; multiple null values allowed. 5. Order: Does not maintain insertion or sorting order. 6. Performance: Fast for put and get operations (O(1) average). 7. Thread-Safety: Not synchronized (use ConcurrentHashMap for thread-safe operations). 8. Use Cases: Quick lookups, caching, and mappings. 9. Methods: put, get, remove, keySet, values, entrySet. 10. Example: HashMap<String, Integer> map = new HashMap<>();
79
56
356
27 Nov 2024
Day 6/160 Easy question related to majority element occurring more than n/3. Used Hashmap to keep a track element and freq of occurrence. In the latter half, traverse in entryset and add in result arraylist. At the end, just sort the result array. #gfg160 and #geekstreak2024
5
42
11 Jul 2024
Map<Key, Value># entrySet().stream() を使ったコードがMap.Entryへの低レベルなアクセスだらけでかなり読みにくい。似たようなコードの重複も目立つ。 アプリケーション独自の KeyValueクラスを作って、Set<KeyValue># stream()操作に変えたら、詳細が隠蔽され意図が伝わりコードになった。さらに、
1
6
16
3,224
17 Feb 2024
New Post: Collect Stream of entrySet() to a LinkedHashMap buff.ly/3HVeRr3

2
14
3,804
1 Feb 2024
String getVal(Integer key, Map<Integer, String> map) { return map .entrySet() .stream() .filter(e -> e.getKey().compareTo(key) == 0) .map(Map.Entry::getValue) .flatMap(Collection::stream) .findFirst() .get(); } 🤔
1
2
138
Dia 32/100 #100DiasDeCodigo Hoje estudei a interface Map, que mapeia valores para chaves, e algumas de suas classes (HashMap, LinkedHashMap e TreeMap) e alguns de seus métodos como put, values, keySet, entrySet
1
15
127
30 Aug 2023
Day 49 #100DaysOfCode 🚀 Wrapped up the HashMap exercises and quiz! Found it intriguing to solve problems using entrySet vs. keySet. Sometimes the journey varies, but the destination remains the same. #Java
1
20
327
27 Aug 2023
Day 47 #100DaysOfCode: Dived into HashMaps today in #Java ✅Broke down a DNA string into codons ✅Populated a HashMap by iterating through the string ✅Discovered the most common codon & its count ✅Mastered iterating through a HashMap using entrySet ✅Built test
1
23
346
#python #プログラミング勉強中 #プログラミング初学者 #ITエンジニア #エンジニアと繋がりたい #駆け出しエンジニアと繋がりたい #ITエンジニア #PGボックス 【Python】 辞書.items():辞書のキーと値を取得する Javaなら「entrySet()」を使う感じ。 Entryはキーと値がセットになっています。
1
11
151
Backward compatibility, basically. "covariant overrides on the keySet() and entrySet() methods of the SequencedMap interface could also result in incompatibilities with subclasses that override these methods." openjdk.org/jeps/431

4
65
25 Apr 2023
Replying to @tagir_valeev
Do you know why they added sequencedKeySet(), sequencedValues() and sequencedEntrySet() to SequencedMap instead of overriding keySet(), values() and entrySet()? 🤔
2
1
263
Updated an answer to a SO question I posted ten years ago this month. Deleted an anonymous inner class example (remember those?) and added an explanation why forEachKeyValue is more efficient than entrySet for @EclipseCollect Map implementations. stackoverflow.com/a/13943066…

2
657
Why have a Map.mapEntries(BiFunction<K, V, T> function) : List<T> if you can rather do ….entrySet() .stream() .map(it -> new Foo(it.getKey(), it.getValue())) .collect(Collectors.toList()); ? So much more (fun|code)! 🥳☕️ #Java
3
1
15
25 Oct 2022
未だにjavaでmapのキーバリューの取得の仕方を忘れちゃう それぞれ取得する場合はsetKey()とvalues()、全部はentrySet() get()の1パラにキーを設定すれば値取得 #Java #エンジニアと繋がりたい #駆け出しエンジニアと繋がりたい
13