1Z0-829 Working with Arrays and Collections • Set 7
1Z0-829 Working with Arrays and Collections Practice Test 7 — 15 questions with explanations. Free, no signup.
An application needs to maintain a set of unique customer IDs (type String) and frequently check if an ID is already present. The set is expected to contain up to 100,000 IDs. The current implementation uses a TreeSet, but performance tests show that the contains() operation is slower than desired. The developer considers switching to a HashSet. However, the business requires that when iterating the set, IDs must appear in sorted order. The developer proposes to convert the HashSet to a sorted list each time iteration is needed. Iteration occurs rarely (once per hour). What is the best approach?
Choose an answer to begin — your selection is scored in the full session.
15 questions · instant feedback and full explanations after every question.