Beispiel #1
0
 /** {@inheritDoc} */
 public TByteList inverseGrep(TByteProcedure condition) {
   TByteArrayList list = new TByteArrayList();
   for (int i = 0; i < _pos; i++) {
     if (!condition.execute(_data[i])) {
       list.add(_data[i]);
     }
   }
   return list;
 }
Beispiel #2
0
 /** {@inheritDoc} */
 public TByteList subList(int begin, int end) {
   if (end < begin) {
     throw new IllegalArgumentException("end index " + end + " greater than begin index " + begin);
   }
   if (begin < 0) {
     throw new IndexOutOfBoundsException("begin index can not be < 0");
   }
   if (end > _data.length) {
     throw new IndexOutOfBoundsException("end index < " + _data.length);
   }
   TByteArrayList list = new TByteArrayList(end - begin);
   for (int i = begin; i < end; i++) {
     list.add(_data[i]);
   }
   return list;
 }
Beispiel #3
0
 /** {@inheritDoc} */
 @Override
 public boolean equals(Object other) {
   if (other == this) {
     return true;
   } else if (other instanceof TByteArrayList) {
     TByteArrayList that = (TByteArrayList) other;
     if (that.size() != this.size()) return false;
     else {
       for (int i = _pos; i-- > 0; ) {
         if (this._data[i] != that._data[i]) {
           return false;
         }
       }
       return true;
     }
   } else return false;
 }