Skip to content

Instantly share code, notes, and snippets.

/listToArray Secret

Created June 24, 2016 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1343b1745c030a047fe35c390384bf2e to your computer and use it in GitHub Desktop.
Save anonymous/1343b1745c030a047fe35c390384bf2e to your computer and use it in GitHub Desktop.
write a test for this?
/**
* private method to convert a string to an array
*
* @return boolean
*/
private String [] mailToToArray(){
List<String> mailToList = new ArrayList<String>();
try(Scanner emailScanner = new Scanner(mailTo) ){
emailScanner.useDelimiter(":");
while ( emailScanner.hasNext() ){
mailToList.add(emailScanner.next());
}
}
return mailToList.toArray(new String[mailToList.size()]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment