Exemplo n.º 1
0
 private static int getPosition(Collection<Element> elements, Element obj) {
   int i = 0;
   for (Element element : elements) {
     if (obj.equals(element)) {
       return i + 1;
     }
     i++;
   }
   throw new RuntimeException("数据错误!");
 }