I have a Hashset that has been populated with Penny objects and I want to create a method to remove one of these Penny objects from the HashSet and return it. Here is the method I have created to do this but it does not work as I get error messages. can someone explain to me the correct way of doing this
public Penny removePenny(){
if(penniesSet.size()<= 0){
return null;
}
else
penniesSet.remove(Penny)
return penniesSet.get(Penny)
}