I have the following piece of code with java streams
You can see that I am having an error on the 4th line. Basically the error says Unhandled Exception: AddressException. But you can see that I am catching it within catch block. But still that is not working. Eventhough, if I use a try catch block within the map method it works as shown below
  public List<InternetAddress> getListOfInternetEmailAddresses(List<String> toEmails){
       List<InternetAddress> internetAddresses = new ArrayList<>();
            internetAddresses = toEmails.stream().map(a->{
                InternetAddress ia = null;
                try{
                   ia = new InternetAddress(a);
                } catch (AddressException e) {
                    
                }
                return ia;
            }).collect(Collectors.toList());
        return internetAddresses;
    }
Does anyone know why this behaviour and if knows please give some insights to that. One more quetion, does the anonymous inner class will also behave the same ?
