1 package uk.co.jezuk.mango.algorithms; 2 3 13 public class FindPosition 14 { 15 static public int execute(java.util.Iterator iterator, Object value) 16 { 17 if(iterator == null) 18 return -1; 19 20 int count = 0; 21 while(iterator.hasNext()) 22 { 23 Object obj = iterator.next(); 24 if(value.equals(obj)) 25 return count; 26 ++count; 27 } 29 return -1; 30 } 32 private FindPosition() { } 33 } | Popular Tags |