@Override
 public void forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure) {
   objectIntProcedure.value(this.element1, 0);
   objectIntProcedure.value(this.element2, 1);
   objectIntProcedure.value(this.element3, 2);
   objectIntProcedure.value(this.element4, 3);
 }
 @Override
 public void forEachWithIndex(ObjectIntProcedure<? super V> objectIntProcedure) {
   objectIntProcedure.value(this.value1, 0);
   objectIntProcedure.value(this.value2, 1);
   objectIntProcedure.value(this.value3, 2);
   objectIntProcedure.value(this.value4, 3);
 }
Exemplo n.º 3
0
 @Override
 public void forEachWithIndex(int from, int to, ObjectIntProcedure<? super T> objectIntProcedure) {
   if (from < 0 || to < 0) {
     throw new IllegalArgumentException("Neither from nor to may be negative.");
   }
   T[] localItems = this.items;
   if (from <= to) {
     for (int i = from; i <= to; i++) {
       objectIntProcedure.value(localItems[i], i);
     }
   } else {
     for (int i = from; i >= to; i--) {
       objectIntProcedure.value(localItems[i], i);
     }
   }
 }