通行证
- 积分
- 683
- 大米
- 颗
- 鳄梨
- 个
- 水井
- 尺
- 蓝莓
- 颗
- 萝卜
- 根
- 小米
- 粒
- 学分
- 个
- 注册时间
- 2016-6-14
- 最后登录
- 1970-1-1
|
- Set s = { 3 4 }
- Set s2 = { 4 5 }
- Set s3 = { 3 5 8 }
- After s.union(s2), s = { 3 4 5 }
- After s.intersect(s3), s = { 3 5 }
- s.cardinality() = 2
- [code]An empty list should be [ ]: [ ]
- l.isEmpty() should be true: true
- l.length() should be 0: 0
- Finding front node p of l.
- p.isValidNode() should be false: false
- p.item() should throw an exception, and did.
- p.setItem() should throw an exception, and did.
- p.next() should throw an exception, and did.
- p.prev() should throw an exception, and did.
- p.insertBefore() should throw an exception, and did.
- p.insertAfter() should throw an exception, and did.
- p.remove() should throw an exception, and did.
- Finding back node p of l.
- p.isValidNode() should be false: false
- p.item() should throw an exception, and did.
- p.setItem() should throw an exception, and did.
- p.next() should throw an exception, and did.
- p.prev() should throw an exception, and did.
- p.insertBefore() should throw an exception, and did.
- p.insertAfter() should throw an exception, and did.
- p.remove() should throw an exception, and did.
- l after insertFront(10) should be [ 10 ]: [ 10 ]
- l is a list of 3 elements: [ 1 2 3 ]
- n.item() should be 1: 1
- n.item() should be 2: 2
- n.item() should be 2: 2
- n.item() should be 4: 4
- n.item() should be 3: 3
- n.item() should be 6: 6
- After doubling all elements of l: [ 2 4 6 ]
- p.isValidNode() should be false: false
- p.item() should throw an exception, and did.
- p.setItem() should throw an exception, and did.
- p.next() should throw an exception, and did.
- p.prev() should throw an exception, and did.
- p.insertBefore() should throw an exception, and did.
- p.insertAfter() should throw an exception, and did.
- p.remove() should throw an exception, and did.
- n.item() should be 6: 6
- n.item() should be 12: 12
- n.item() should be 4: 4
- n.item() should be 8: 8
- n.item() should be 2: 2
- n.item() should be 4: 4
- After doubling all elements of l again: [ 4 8 12 ]
- p.isValidNode() should be false: false
- p.item() should throw an exception, and did.
- p.setItem() should throw an exception, and did.
- p.next() should throw an exception, and did.
- p.prev() should throw an exception, and did.
- p.insertBefore() should throw an exception, and did.
- p.insertAfter() should throw an exception, and did.
- p.remove() should throw an exception, and did.
- Removing middle element (8) of l: 8
- l is now: [ 4 12 ]
- p.isValidNode() should be false: false
- p.item() should throw an exception, and did.
- p.setItem() should throw an exception, and did.
- p.next() should throw an exception, and did.
- p.prev() should throw an exception, and did.
- p.insertBefore() should throw an exception, and did.
- p.insertAfter() should throw an exception, and did.
- p.remove() should throw an exception, and did.
- Removing end element (12) of l: 12
- l is now: [ 4 ]
- p.isValidNode() should be false: false
- p.item() should throw an exception, and did.
- p.setItem() should throw an exception, and did.
- p.next() should throw an exception, and did.
- p.prev() should throw an exception, and did.
- p.insertBefore() should throw an exception, and did.
- p.insertAfter() should throw an exception, and did.
- p.remove() should throw an exception, and did.
- Removing first element (4) of l: 4
- l is now: [ ]
- p.isValidNode() should be false: false
- p.item() should throw an exception, and did.
- p.setItem() should throw an exception, and did.
- p.next() should throw an exception, and did.
- p.prev() should throw an exception, and did.
- p.insertBefore() should throw an exception, and did.
- p.insertAfter() should throw an exception, and did.
- p.remove() should throw an exception, and did.
复制代码 [/code] |
|