What is the difference between the 2 calls:
Set<Record> instances = new HashSet<Record>();  -  on one hand 
HashSet<Record> instances = new HashSet<Record>();  - on other hand
What is the difference between the 2 calls:
Set<Record> instances = new HashSet<Record>();  -  on one hand 
HashSet<Record> instances = new HashSet<Record>();  - on other hand
 
    
     
    
    In the first case, you can reassign instances to an instance of any subtype of Set<Record>.  In the second case, you can reassign instances only to an instance of a subtype of HashSet<Record>.
 
    
    HashSet implements the interface Set. Both statements store the HashSet in the variable instances (there is no difference, both statements store the same data).
The first statements however stores the HashSet in a Set. This has some advantages, for example you could change HashSet to TreeSet without changing your other code.
