Flashcards

Quick study sessions to strengthen memory and retain key concepts.

Flashcard Study

Java: Map Interface and HashMap

Front

How do you add an element to a HashMap?

Use the put() method to add a key-value pair. The put() method is used to insert key-value pairs…

View Card →
Flashcard Study

Java: Map Interface and HashMap

Front

Why does a HashMap in Java matter in this design?

A HashMap stores data as key-value pairs. Frame the concept in practical terms so you can explain it…

View Card →
Flashcard Study

Java: Map Interface and HashMap

Front

When should you reach for `HashMap`?

When repeated direct lookup by key is the main operation. A map makes key-to-value lookup explicit in the…

View Card →
Flashcard Study

Java: List Interface and ArrayList

Front

ArrayList vs. LinkedList: Performance Considerations?

ArrayList provides faster indexed access but slower insertion at the start/middle. Choosing between ArrayList and LinkedList depends on…

View Card →
Flashcard Study

Java: List Interface and ArrayList

Front

Understanding Duplicate Elements in an ArrayList?

ArrayList allows duplicate elements and maintains insertion order. In Java, an ArrayList can contain duplicate elements, meaning you…

View Card →
Flashcard Study

Java: List Interface and ArrayList

Front

Why does calling clear() on an ArrayList matter in practice?

Clears all elements without changing capacity. Calling clear() on an ArrayList removes all elements, but the underlying array's…

View Card →
Flashcard Study

Java: List Interface and ArrayList

Front

Why is understanding List equality important in Java?

Equality affects behavior of contains(), remove(). Understanding List equality is crucial because methods like contains() and remove() depend…

View Card →
Flashcard Study

Java: List Interface and ArrayList

Front

How do List iterators differ from standard for-each loops?

Iterators allow safe concurrent modification. List iterators provide methods like remove() that allow safe modification of the list…

View Card →
Flashcard Study

Java: List Interface and ArrayList

Front

What method checks if an ArrayList is empty?

The isEmpty() method. Frame the concept in practical terms so you can explain it during interview discussion. The…

View Card →
Flashcard Study

Java: List Interface and ArrayList

Front

How does ArrayList handle element removal performance-wise?

Removal is O(n) due to element shifting. Frame the concept in practical terms so you can explain it…

View Card →