Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public int positionOfFirstFiveFromBeginning(){
- int result = 0;
- if(first == null){
- return -1;
- }
- Node x = first;
- while(x != null){
- if(x.item == 5.0){
- return result;
- }
- result++;
- x = x.next;
- }
- return result;
- }
- public int positionOfFirstFiveFromBeginning(){
- int result = 0;
- if(first == null || first.item != 5.0){
- return -1;
- }
- Node x = first;
- while(x != null){
- if(x.item == 5.0){
- return result;
- }
- result++;
- x = x.next;
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement