Skip to content

Instantly share code, notes, and snippets.

@mattpetters
Created November 12, 2017 18:33
Show Gist options
  • Save mattpetters/00660c8cc0b5ebc23a0dbd154459555b to your computer and use it in GitHub Desktop.
Save mattpetters/00660c8cc0b5ebc23a0dbd154459555b to your computer and use it in GitHub Desktop.
while (sc.hasNextLine()){
String line = sc.nextLine();
if (line.isEmpty()){
continue;
} else {
String node = nextLine;
String anotherLine = sc.nextLine();
while (!anotherLine.isEmpty()) {
String[] neighborInfo = anotherLine.split("\\s+");
String neighborNode = neighborInfo[1];
int edgeWeight = Integer.parseInt(neighborInfo[2]);
anotherLine = sc.nextLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment