The Artima Developer Community
Sponsored Link

Java Buzz Forum
HashSet class

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
instanceof java

Posts: 576
Nickname: instanceof
Registered: Jan, 2015

instanceof java is a java related one.
HashSet class Posted: Nov 21, 2015 6:30 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by instanceof java.
Original Post: HashSet class
Feed Title: Instance Of Java
Feed URL: http://feeds.feedburner.com/blogspot/TXghwE
Feed Description: Instance of Java. A place where you can learn java in simple way each and every topic covered with many points and sample programs.
Latest Java Buzz Posts
Latest Java Buzz Posts by instanceof java
Latest Posts From Instance Of Java

Advertisement

Hierarchy of HashSet class:


 

 public class HashSet<E>
        extends AbstractSet<E>
           implements Set<E>, Cloneable, java.io.Serializable
 

Key points:

  • HashSet is sub class of AbstractSet class.
  • Underlying data structure of HashSet is HashTable.
  • HashSet implements Serializable and Cloneable interfaces
  • HashSet does not allow duplicate elements.
  • Insertion order is not preserved. No order(Based on hashcode of objects)

Constructors of HashSet:

1.HashSet( )
  • Creates an empty HashSet object with default initial capacity 16.  Fill ratio or load factor 0.75
2.HashSet(Collection obj)
  • This constructor initializes the hash set by using the elements of the collection obj.
3.HashSet(int capacity)
    • Creates an empty HashSet object with given capacity.
      4.HashSet(int capacity, float fillRatio)
      • This constructor initializes both the capacity and the fill ratio (also called load capacity) of the hash set from its arguments (fill ratio 0.1 to 1.0)

      Read: HashSet class

      Topic: HTTP/2 With JBoss EAP 7 Previous Topic   Next Topic Topic: Enterprise Spring examples and integration tests

      Sponsored Links



      Google
        Web Artima.com   

      Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use