Add java21-features module: runnable demos and captured output for the ankurm.com java21-features article
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
$ javac src/SequencedCollectionsDemo.java && java SequencedCollectionsDemo (21.0.12.1)
|
||||
getFirst/getLast: a c
|
||||
reversed view : [c, b, a]
|
||||
addFirst+removeLast: [z, a, b]
|
||||
LinkedHashSet reversed: [3, 2, 1]
|
||||
firstEntry/lastEntry : x=1 z=3
|
||||
putFirst : {w=0, x=1, y=2, z=3}
|
||||
reversed map : {z=3, y=2, x=1, w=0}
|
||||
view sees add : [3, 2, 1]
|
||||
immutable list : UnsupportedOperationException
|
||||
HashSet : no getFirst (unordered)
|
||||
Reference in New Issue
Block a user