import java.util.*; class Ideone{ public static void main (String[] args) throws java.lang.Exception { try { // Throws List.of("Foo").sort(Comparator.naturalOrder()); } catch(Exception e) { e.printStackTrace(System.out); } // Does not throw Collections.singletonList("Foo").sort(Comparator.naturalOrder()); }}
Standard input is empty
java.lang.UnsupportedOperationException at java.base/java.util.ImmutableCollections.uoe(ImmutableCollections.java:72) at java.base/java.util.ImmutableCollections$AbstractImmutableList.sort(ImmutableCollections.java:111) at Ideone.main(Main.java:10)
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!