Ejemplo n.º 1
0
 @Override
 default boolean startsWith(Iterable<? extends T> that, int offset) {
   Objects.requireNonNull(that, "that is null");
   if (offset < 0) return false;
   if (that instanceof IndexedSeq) {
     IndexedSeq<? extends T> dhat = (IndexedSeq<? extends T>) that;
     int i = offset;
     int j = 0;
     int thisLen = length();
     int thatLen = dhat.length();
     while (i < thisLen && j < thatLen && Objects.equals(this.get(i), dhat.get(j))) {
       i++;
       j++;
     }
     return j == thatLen;
   } else {
     int i = offset;
     int thisLen = length();
     java.util.Iterator<? extends T> thatElems = that.iterator();
     while (i < thisLen && thatElems.hasNext()) {
       if (!Objects.equals(this.get(i), thatElems.next())) {
         return false;
       }
       i++;
     }
     return !thatElems.hasNext();
   }
 }
Ejemplo n.º 2
0
 public final V getValueAt(int index) {
   return values.get(index);
 }