Question

1.
2.
3.
4.
Answer (Detailed Solution Below)

Option 3 : LinkedHashSet

Advertisement

Detailed Solution

सही उत्तर LinkedHashSet है।

Key Points
Helpful?
PrepSnapprepsnap.in • Part -A

Question:

Which Java collection stores unique elements and preserves their insertion order? / कौन-सा Java कलेक्शन अद्वितीय एलिमेंट्स संग्रहित करता है और उनके निवेशन क्रम को बनाए रखता है?

1.
HashSet
2.
TreeSet
3.
LinkedHashSet
4.
ArrayList

Correct Answer: LinkedHashSet

LinkedHashSet combines hashing with a linked list running through the entries, giving uniqueness plus insertion-order iteration. TreeSet sorts elements, HashSet gives no order guarantee, and ArrayList allows duplicates. / LinkedHashSet हैशिंग को एंट्रियों से गुजरने वाली लिंक्ड लिस्ट के साथ जोड़ता है, जिससे अद्वितीयता के साथ निवेशन-क्रम पुनरावृत्ति मिलती है। TreeSet एलिमेंट्स को क्रमबद्ध करता है, HashSet क्रम की गारंटी नहीं देता, और ArrayList डुप्लिकेट की अनुमति देता है।

Downloaded from PrepSnap (prepsnap.in)