This post explains implementation of Hashtable. We can find this class in java.util. Hashtable maps keys to values , these keys and values can be any non null objects. Hashtable uses hashing function algorithm so the object which we use for key must implement equals and hashcode methods. Initial capacity and the load factor are […]Continue Reading →
How to use TreeSet in Java : TreeSet in java is a class which implements Set interface. Let see few characteristics of TreeSet in java before taking look at java treeset example. TreeSet in java 1. TreeSet in java guarantees sorted set of elements which are arranged in ascending order. 2. TreeSet in java provides […]Continue Reading →
HashSet : HashSet implements Set interface. To store the values it uses Hashtable internally which uses hashing mechanism. Because of Hashing there are two advantages, first because it is used to find duplicates using the key and second is it gives constant time performance for operations such as add, remove, contains etc. Lets look at […]Continue Reading →
Lets see we can use which collections according to their characteristics : ArrayList : As ArraylList implements List interface. ArrayList allows random access and fast iteration. So ArrayList can be used when 1. We need random access to the element. 2. When we normally not required to remove the elements between the others as removing […]Continue Reading →
Generics can be used to create the collection with holding the objects of certain type. This eliminates the need of unnecessary casting of the object while retrieving from the collection. Now lets look at the list containing integer objects : List integerlist = new ArrayList(); integerlist .add(new Integer(777)); In this case if we try to […]Continue Reading →
You may want to read it!
- Enum in java with java enum examples
- Simple JTable example using AbstractTableModel
- How to print message , stacktrace of Exception in java?
- How to you align/justify JTable column header text?
- Tutorial Socket Programming :Example Creating the Socket connection in java
- How to create splitpanes in java using JSplitPane?
- How to show DialogBox in java? Complete JOptionPane tutorial.
- How make JComboBox drop-down width as wide as needed?
- How to convert exponential format to Decimal number format in Java?
- 5 alternatives to meebo messenger for instant messaging