public static List < String > parse ( String address , String addresses ) { List < String > result ; // backwards compatibility - older clients only send a single address in the single address header and don't supply the multi-address header if ( addresses == null || addresses . isEmpty ( ) ) { addresses = address ; } if ( addresses == null ) { result = Collections . emptyList ( ) ; } else { String [ ] parts = addresses . split ( "," ) ; result = new ArrayList < String > ( parts . length ) ; for ( String part : parts ) { part = part . trim ( ) ; if ( NetworkAddress . isValidIPAddress ( part ) ) { result . add ( part ) ; } } } return result ; }
Parse a comma separated string of ip addresses into a list Only valid IP address are returned in the list