Created
February 23, 2016 09:06
-
-
Save mox601/9fe97267ca45d5794a6d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static List<ServerAddress> parseServerAddresses(final String serverAddressesString) { | |
final String[] serversSplitOnComma = serverAddressesString.split(","); | |
final List<ServerAddress> serverAddresses = new ArrayList<>(3); | |
for (final String serverAndPort : serversSplitOnComma) { | |
final String[] splitOnColon = serverAndPort.split(":"); | |
final String host = splitOnColon[0]; | |
final String portAsStr = splitOnColon[1]; | |
final int port = Integer.parseInt(portAsStr); | |
final ServerAddress aServerAddress = new ServerAddress(host, port); | |
serverAddresses.add(aServerAddress); | |
} | |
return serverAddresses; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment