Java interview warm-up
Integer caching, strings, equals/hashCode, streams and concurrency — the Java fundamentals screens probe.
- Integer Cache and == Why 127 == 127 but 128 != 128 for boxed Integers.
- String Immutability and Interning Methods return new strings; compile-time constants are interned.
- Integer Division and String Concatenation Left-to-right evaluation of + with numbers, chars and strings.
- equals() and hashCode() Done Right Implement value equality so HashSet and HashMap behave correctly.
- Reporting with Streams and Collectors Group, count, average and sort records using the Stream API.
- Thread-Safe Counting with ExecutorService Fix a race condition with atomics and split work across a thread pool.
- Two Sum Find the indices of the two numbers that add up to a target.
- LRU Cache A fixed-capacity cache that evicts the least recently used key, with O(1) get and put.
- Merge Intervals Merge all overlapping intervals.