โ† All 1Z0-819 Flashcard Decks

Core APIs & Data Manipulation Flashcards

7 cards from real 1Z0-819 practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Core APIs & Data Manipulation flashcards as text
  1. Which `Map` method returns the value for a key, or a default if the key is absent, WITHOUT inserting the default?

    Answer: getOrDefault()

    `getOrDefault(key, defaultValue)` returns the default when the key is missing but never modifies the map.

  2. What is the time complexity of `LinkedList.get(index)` in Java?

    Answer: O(n)

    `LinkedList` is a doubly-linked list; random access by index requires traversal, giving O(n) time.

  3. Which statement about `String.intern()` is correct?

    Answer: It returns a canonical String from the string pool

    `intern()` ensures the string is stored in (or retrieved from) the string constant pool, enabling identity equality (`==`) for equal strings.

  4. What does `Collections.unmodifiableList(list)` guarantee?

    Answer: Mutations via the wrapper throw UnsupportedOperationException

    The unmodifiable wrapper blocks writes through itself, but the backing list can still be mutated directly; it also provides no thread safety.

  5. Which `Stream` terminal operation short-circuits and returns as soon as the predicate fails?

    Answer: allMatch()

    `allMatch()` stops processing as soon as one element does not satisfy the predicate, making it a short-circuit terminal operation.

  6. What happens when you call `iterator.remove()` without first calling `iterator.next()`?

    Answer: Throws IllegalStateException

    The `Iterator` contract requires `next()` to be called before `remove()`; violating this throws `IllegalStateException`.

  7. Which `java.time` class represents a date and time WITHOUT a timezone or offset?

    Answer: LocalDateTime

    `LocalDateTime` holds a date-time with no timezone context; `ZonedDateTime` and `OffsetDateTime` include zone or offset information.