-
-
Save anataliocs/f64faf128223a324af18a4df05b01a49 to your computer and use it in GitHub Desktop.
toString method to display a well-formatted 2d array in Java
This file contains 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
@Override | |
public String toString() { | |
return lineSeparator() + Arrays.stream(matrix) | |
.map(a -> Arrays.toString(a) + lineSeparator()) | |
.collect(Collectors.joining(lineSeparator())); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment