Skip Navigation Links



HashSet in Java – 10 Examples Programs Tutorial

Author : Javin Paul      Blog :TIBCO RV FIX PROTOCOL JAVA TUTORIAL      Date: 6/24/2012 5:43:00 AM


HashSet in Java is a collection which implements Set interface and backed by an HashMap. Since HashSet uses HashMap internally it provides constant time performance for operations like add, remove, contains and size give HashMap has distributed elements properly among the buckets. Java HashSet does not guarantee any insertion orders of the set but it allows null elements. HashSet can be used in place of ArrayList to store the object if you require no duplicate and don't care about insertion order. Iterator of HashSet is fail-fast and throws ConcurrentModificationException if HashSet instance is modified concurrently during iteration by using any method other than remove() method of iterator class.If you want to keep insertion order by using HashSet than consider using LinkedHashSet. It is also a very important part of any Java collection interview, In short correct understanding of HashSet is must for any Java developer.
Read more »

Bloggers

active bloggers in the last 24 hrs. Number shown in the bracket represents number of posts published in past 24 hrs,


other authors(73)

Vikram Karve(4)

BUTTERFLIES OF TIME(3)

Ramanujam Sridhar(3)

Firoze Shakir Photographerno1(2)

Jabberwock(2)

Sakshi Garg(2)

Venkataramanan Ramasethu(2)

Aarthi(1)

AbhiLaSH RuHeLa(1)

Abi(1)

Aditi(1)

Akhilesh(1)

Anil(1)

Anil P(1)

Ankur(1)

anouradha bakshi(1)

Anu Lal(1)

Anu Varma(1)

Anubhav Sharma(1)

anupriya(1)

AS...(1)

ashok(1)

bdoza(1)

Bhagyashree(1)

Bharathy(1)

celestialrays(1)

chaoticplanner(1)

Deeps(1)

Dew(1)

Dinakarr(1)

Divenita(1)

Ekta khetan(1)

ephemeral desires(1)

Familycook(1)

Fidarose Isha(1)

Govind Kumar(1)

Hari Chandana P(1)

Harimohan(1)

harish p i(1)

I for an Eye(1)

Insignia(1)

J.A. Kumar(1)

Joshua S(1)

KALVA(1)

Kalyan P(1)

KK(1)

KParthasarathi(1)

Krishna Rao(1)

Madhaw Tiwari(1)

Mahima Kohli(1)

Maitreyee Bhattacharjee Chowdhury(1)

Meena Kannan(1)

Meher(1)

Mihir Govilkar(1)

Mr Rancorous(1)

MUNZ TDT(1)

Mythreyi(1)

Nanka(1)

Naresh Surampudi(1)

Nayna Kanabar(1)

Newsline Features and Press Agency, Agra - 282005 [U.P.](1)

Nidz(1)

Nik P(1)

Nikhil Sheth(1)

Nishant Chaturvedi(1)

Nivedita Thadani(1)

Nona(1)

Ordinary Gal(1)

palash ranjan khound(1)

parth joshi(1)

Phalgunn Maharishi(1)

pinksocks(1)

pixie(1)

Prabal(1)

Prahallad Panda(1)

Priya(1)

Raafay Awan(1)

rahul(1)

Raksha(1)

Rama Subramanian(1)

ravi dabas(1)

Renu(1)

Reshmi Mahesh(1)

Ritcha(1)

RNA Corp(1)

Rohit Kaveeshwar(1)

RWABhagidari.blogspot.com(1)

Sandhya(1)

Sanjeev(1)

Santosh Bangar(1)

Saravanan Sivaraman(1)

ScottGu(1)

Sharjeel(1)

Shinymist(1)

Shobha(1)

Shobhaa De(1)

Shrikant Lokhande(1)

Shriti(1)

Sriram Khé(1)

Subha(1)

Suchismita(1)

Sushma Harish(1)

tikulicious(1)

Vashi Chandiramani(1)

Vasudev Ram(1)

Vasudha Rao(1)

Vatsala Dorai Rajan(1)

winnie(1)

अफ़लातून अफ़लू(1)

மதி (GS)(1)


garland of Languages of India
an amalgamation of the diversified traditions
gracefully presented with novelty
http://www.haaram.com