equal
deleted
inserted
replaced
519 |
519 |
520 second |
520 second |
521 "return the second element of the collection. |
521 "return the second element of the collection. |
522 For unordered collections, this simply returns the second |
522 For unordered collections, this simply returns the second |
523 element when enumerating them. |
523 element when enumerating them. |
524 Bla Bla This should be redefined in subclasses." |
524 This should be redefined in subclasses." |
525 |
525 |
526 |count| |
526 ^ self nth:2 |
527 |
|
528 count := 1. |
|
529 self do:[:e | |
|
530 count == 2 ifTrue:[^ e]. |
|
531 count := count + 1 |
|
532 ]. |
|
533 |
|
534 "error if collection is smaller" |
|
535 ^ self notEnoughElementsError |
|
536 |
527 |
537 " |
528 " |
538 #(1 2 3) second |
529 #(1 2 3) second |
539 " |
530 " |
540 |
|
541 ! |
531 ! |
542 |
532 |
543 seventh |
533 seventh |
544 "return the seventh element of the collection. |
534 "return the seventh element of the collection. |
545 For unordered collections, this simply returns the sixth |
535 For unordered collections, this simply returns the sixth |
2482 ! ! |
2472 ! ! |
2483 |
2473 |
2484 !Collection class methodsFor:'documentation'! |
2474 !Collection class methodsFor:'documentation'! |
2485 |
2475 |
2486 version |
2476 version |
2487 ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.136 2003-03-02 20:39:30 stefan Exp $' |
2477 ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.137 2003-03-24 17:18:24 cg Exp $' |
2488 ! ! |
2478 ! ! |
2489 |
2479 |
2490 Collection initialize! |
2480 Collection initialize! |