So from my understanding of final you can't change the value of variable after. In the case of a private final foo HashSet<>() = new HashSet<>() I can use foo as a HashSet and edit the values in it but I can't reassign foo right? 
            Asked
            
        
        
            Active
            
        
            Viewed 1,918 times
        
    0
            
            
         
    
    
        ford prefect
        
- 7,096
- 11
- 56
- 83
1 Answers
6
            final will prevent you to assign any new value to the variable, but it won't make your object immutable.
In your example,
private final foo HashSet<String>() = new HashSet<>();
foo.put("bar");              // is correct
foo = new HashSet<>();       // will fail at compilation
 
    
    
        dotvav
        
- 2,808
- 15
- 31