| Class | Order | Sorting | Duplicates | Nulls | Synchronised |
| ArrayList | Y | N | Y | Y | N |
| LinkedList | Y | N | Y | Y | N |
| Vector | Y | N | Y | Y | Y |
| Map(Tree Map) | Natural Order But not insertion order |
Y | Y | Keys-->No Nulls Values-->Allows multiple |
N |
| HashMap | N | N | Y | Key-->Allow only 1 Null Values-->Allows multiple |
N |
| HashTable | N | N | Y | N | Y |
| Set(Tree Set) | Natural Order | Y | N | N | N |
| HashSet | No | N | N | Y | N |
| LinkedHashSet | N | N | N | Y | N |
List maintains Insertion Order
Map maintains Key-Value pair
Set does not allows Duplicates
-->All are not Sync except Vector and HashTable
-->All are not Sorted except TreeMap and TreeSet
-->All allows Null except TreeMap,HashTable,TreeSet
-->All allows Duplicates except Set related
What are Collection Objects in hibernate?
| Collection type | Mapping and Description |
|---|---|
| java.util.Set | This is mapped with a <set> element and initialized with java.util.HashSet |
| java.util.SortedSet | This is mapped with a <set> element and initialized with java.util.TreeSet. The sort attribute can be set to either a comparator or natural ordering. |
| java.util.List | This is mapped with a <list> element and initialized with java.util.ArrayList |
| java.util.Collection | This is mapped with a <bag> or <ibag> element and initialized with java.util.ArrayList |
| java.util.Map | This is mapped with a <map> element and initialized with java.util.HashMap |
| java.util.SortedMap | This is mapped with a <map> element and initialized with java.util.TreeMap. The sort attribute can be set to either a comparator or natural ordering. |
No comments:
Post a Comment