Files
javademos/docs/output/80-hub-examples.txt

70 lines
4.0 KiB
Plaintext

# One class file (javac 21 --release 21), four JVMs
$ java -cp hub HubExamples (JDK 21)
java.version = 21.0.12.1
CHECK ok : record accessor: c.email()
CHECK ok : record toString: Customer[id=1, [email protected], country=IN]
CHECK ok : compact constructor rejects an email without @: Invalid email
CHECK ok : area(Square(3)) == 9.0
CHECK ok : area(Triangle(4, 5)) == 10.0
CHECK ok : guard pattern: Circle(101) is a large circle
CHECK ok : guard pattern: Circle(1) is a small circle
CHECK ok : all 10,000 virtual-thread tasks completed before close() returned
CHECK ok : and it took seconds, not the 1,000 s a serial loop needs (exact time is machine dependent, not printed)
CHECK ok : Thread.ofVirtual().name(..).start(..) gives a virtual thread
CHECK ok : List.getFirst() / getLast()
CHECK ok : List.reversed(): [chris, brian, alex]
CHECK ok : reversed() is a view, not a copy: it sees the element added afterwards
CHECK ok : LinkedHashSet.getFirst() == 3, getLast() == 5
$ java -cp hub HubExamples (JDK 25)
java.version = 25.0.4.1
CHECK ok : record accessor: c.email()
CHECK ok : record toString: Customer[id=1, [email protected], country=IN]
CHECK ok : compact constructor rejects an email without @: Invalid email
CHECK ok : area(Square(3)) == 9.0
CHECK ok : area(Triangle(4, 5)) == 10.0
CHECK ok : guard pattern: Circle(101) is a large circle
CHECK ok : guard pattern: Circle(1) is a small circle
CHECK ok : all 10,000 virtual-thread tasks completed before close() returned
CHECK ok : and it took seconds, not the 1,000 s a serial loop needs (exact time is machine dependent, not printed)
CHECK ok : Thread.ofVirtual().name(..).start(..) gives a virtual thread
CHECK ok : List.getFirst() / getLast()
CHECK ok : List.reversed(): [chris, brian, alex]
CHECK ok : reversed() is a view, not a copy: it sees the element added afterwards
CHECK ok : LinkedHashSet.getFirst() == 3, getLast() == 5
$ java -cp hub HubExamples (JDK 26)
java.version = 26.0.2.1
CHECK ok : record accessor: c.email()
CHECK ok : record toString: Customer[id=1, [email protected], country=IN]
CHECK ok : compact constructor rejects an email without @: Invalid email
CHECK ok : area(Square(3)) == 9.0
CHECK ok : area(Triangle(4, 5)) == 10.0
CHECK ok : guard pattern: Circle(101) is a large circle
CHECK ok : guard pattern: Circle(1) is a small circle
CHECK ok : all 10,000 virtual-thread tasks completed before close() returned
CHECK ok : and it took seconds, not the 1,000 s a serial loop needs (exact time is machine dependent, not printed)
CHECK ok : Thread.ofVirtual().name(..).start(..) gives a virtual thread
CHECK ok : List.getFirst() / getLast()
CHECK ok : List.reversed(): [chris, brian, alex]
CHECK ok : reversed() is a view, not a copy: it sees the element added afterwards
CHECK ok : LinkedHashSet.getFirst() == 3, getLast() == 5
$ java -cp hub HubExamples (JDK 27)
java.version = 27
CHECK ok : record accessor: c.email()
CHECK ok : record toString: Customer[id=1, [email protected], country=IN]
CHECK ok : compact constructor rejects an email without @: Invalid email
CHECK ok : area(Square(3)) == 9.0
CHECK ok : area(Triangle(4, 5)) == 10.0
CHECK ok : guard pattern: Circle(101) is a large circle
CHECK ok : guard pattern: Circle(1) is a small circle
CHECK ok : all 10,000 virtual-thread tasks completed before close() returned
CHECK ok : and it took seconds, not the 1,000 s a serial loop needs (exact time is machine dependent, not printed)
CHECK ok : Thread.ofVirtual().name(..).start(..) gives a virtual thread
CHECK ok : List.getFirst() / getLast()
CHECK ok : List.reversed(): [chris, brian, alex]
CHECK ok : reversed() is a view, not a copy: it sees the element added afterwards
CHECK ok : LinkedHashSet.getFirst() == 3, getLast() == 5