LinkedList.st
changeset 5556 1056cc5d6ce0
parent 5519 925d9a1eda2c
child 9117 62e21d3b40e2
equal deleted inserted replaced
5555:bf38f4b28455 5556:1056cc5d6ce0
   306     numberOfNodes := 0
   306     numberOfNodes := 0
   307 ! !
   307 ! !
   308 
   308 
   309 !LinkedList methodsFor:'queries'!
   309 !LinkedList methodsFor:'queries'!
   310 
   310 
   311 isEmpty
       
   312     "return true, if the collection is empty"
       
   313 
       
   314     ^ firstLink isNil
       
   315 !
       
   316 
       
   317 notEmpty
       
   318     "return true, if the collection is not empty"
       
   319 
       
   320     ^ firstLink notNil
       
   321 !
       
   322 
       
   323 size
   311 size
   324     "return the size of the LinkedList i.e. the number of nodes"
   312     "return the size of the LinkedList i.e. the number of nodes"
   325 
   313 
   326     ^ numberOfNodes
   314     ^ numberOfNodes
   327 ! !
   315 ! !
   405      l add:(ValueLink new value:'one').
   393      l add:(ValueLink new value:'one').
   406      l add:(ValueLink new value:'two').
   394      l add:(ValueLink new value:'two').
   407      l add:(v := ValueLink new value:'hello').
   395      l add:(v := ValueLink new value:'hello').
   408      l indexOf:v  
   396      l indexOf:v  
   409     "
   397     "
       
   398 !
       
   399 
       
   400 isEmpty
       
   401     "return true, if the collection is empty"
       
   402 
       
   403     ^ firstLink isNil
       
   404 !
       
   405 
       
   406 notEmpty
       
   407     "return true, if the collection is not empty"
       
   408 
       
   409     ^ firstLink notNil
   410 ! !
   410 ! !
   411 
   411 
   412 !LinkedList class methodsFor:'documentation'!
   412 !LinkedList class methodsFor:'documentation'!
   413 
   413 
   414 version
   414 version
   415     ^ '$Header: /cvs/stx/stx/libbasic/LinkedList.st,v 1.33 2000-08-15 14:29:54 cg Exp $'
   415     ^ '$Header: /cvs/stx/stx/libbasic/LinkedList.st,v 1.34 2000-08-22 13:48:28 cg Exp $'
   416 ! !
   416 ! !