Java 11 for competitive programming

Revision en1, by eatmore, 2018-09-29 20:39:21

Previous posts: Java 8, Java 9, Java 10.

Java 11 has been released a few days ago. This post lists some improvements in this version that are useful for competitive programming.

  • New String methods: String.strip(), String.stripLeading(), String.stripTrailing(), String.isBlank() and String.lines() can help with parsing, while String.repeat() can be used to generate output.
  • StringBuilder and StringBuffer instances are now Comparable. Also, CharSequence.compare() can be used to compare String, StringBuilder and StringBuffer values without conversion.
  • Null streams: InputStream.nullInputStream(), OutputStream.nullOutputStream(), Reader.nullReader() and Writer.nullWriter() might be useful for testing.
  • It is now possible to run source files directly: java Solution.java.

As before, if you find any other relevant enhancements, please post them here.

Tags java, java 11

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English eatmore 2018-09-29 20:39:21 1007 Initial revision (published)