TAG · 11 ARTICLES

#collections-streams

Collections & streams

  1. JAVAPython list comprehensions vs Java streamsA list comprehension does the work of stream().filter().map().toList() in one readable line. Here is how to read one, how every common stream operation maps to Python, and when a plain loop is the better choice.29 Nov 2026 · 5 min
  2. JAVAPython list and dict vs Java ArrayList and HashMapPython's collections are built into the language, with their own literal syntax. Here is every ArrayList, HashMap and HashSet method you use daily, mapped to its Python form, plus slicing, tuples and the list-of-dicts shape that carries all JSON and AI data.29 Nov 2026 · 5 min
  3. JAVAAdvanced Java stream interview questions: 18 tricky puzzles with CollectorsSecond highest salary. Duplicates in a list. First non-repeating character. Average salary per department. The toMap duplicate-key trap. These are the stream questions that separate "I've used streams" from "I know streams". Each one built from pieces you already know.27 Nov 2026 · 8 min
  4. JAVAHow to prepare for a Java coding interview: 50 problems in the right orderYou open LeetCode, pick a random problem, get stuck in ten minutes and close the tab. The problem isn't you, it's the order. Here is a study plan of 50 classic Java interview problems, grouped into eight short phases, where each one quietly prepares you for the next.27 Nov 2026 · 6 min
  5. JAVAJava Comparator examples: sort objects by salary, then age, and sort a Map by valueSorting numbers is easy. Interviewers want to see you sort objects: employees by salary, highest first, with ties broken by age. Then the classic follow-up, sort a HashMap by its values. Here is Comparator from the first line to the last, in plain English.27 Nov 2026 · 4 min
  6. JAVAJava HashMap interview programs: word count, most frequent element and group anagramsThree HashMap problems, from easy to a true interview favourite: count the words in a sentence, find the element that appears most often, and group anagrams together. Along the way you'll learn getOrDefault, merge, entrySet and computeIfAbsent for good.27 Nov 2026 · 4 min
  7. JAVAJava ArrayList and Set interview programs: duplicates, common elements, union and sortingRemove duplicates from a list, find the common elements of two lists, take their union, and sort a list both ways. Four short problems that are really one question in disguise: do you know which collection to pick, and why?27 Nov 2026 · 4 min
  8. JAVAJava stack and queue interview programs: valid parentheses, reverse a queue, binary numbersA stack hands back the last thing you put in. A queue hands back the first. Three classic problems show when each one is the right tool, and why modern Java code uses ArrayDeque for both instead of the old Stack class.27 Nov 2026 · 4 min
  9. JAVAJava 8 stream interview questions on an Employee list, with answers"Here's a list of employees. Using streams, give me..." Seven questions that open countless Java interviews: filter by salary, get the names, sort, top 3, average, group by department and the highest salary in each. Each one explained step by step.27 Nov 2026 · 4 min
  10. JAVAJava string interview programs: anagram, first non-repeating character and frequencyFour string problems that come up in almost every Java coding round: check two anagrams, find the first non-repeating character, find the first repeating character, and count each character. They all come down to one skill: counting things.27 Nov 2026 · 4 min
  11. JAVAJava 21 sequenced collections: getFirst, getLast, reversedFor years, getting the last element of a List meant list.get(list.size() - 1), and a LinkedHashSet couldn't do it at all. Java 21 adds one shared set of methods to every ordered collection. Here is what's new, which classes have it, and the traps to avoid.16 Nov 2026 · 4 min