Compose 'list-map' which allows to jump to previous
        op, given offset of current op as index.
964623
def build_prev_op(self):
        
        code = self.code
        codelen = len(code)
        # 2.x uses prev 3.x uses prev_op. Sigh
        # Until we get this sorted out.
        self.prev = self.prev_op = [0]
        for offset in self.op_range(0, codelen):
            op = code[offset]
            for _ in range(instruction_size(op, self.opc)):
                self.prev_op.append(offset)
467554
public static ArrayList<MtasTreeHit<?>> advanceMtasTree(int position,
      IndexInput in, long ref, long objectRefApproxOffset) throws IOException {
    ArrayList<MtasTreeHit<?>> list = new ArrayList<MtasTreeHit<?>>();
    ArrayList<MtasTreeItem> checkList = new ArrayList<MtasTreeItem>();
    AtomicBoolean isSinglePoint = new AtomicBoolean(false);
    AtomicBoolean isStoreAdditonalId = new AtomicBoolean(false);
    AtomicLong nodeRefApproxOffset = new AtomicLong(-1);
    checkList.add(getMtasTreeItem(ref, isSinglePoint, isStoreAdditonalId,
        nodeRefApproxOffset, in, objectRefApproxOffset));
    ArrayList<Long> history = new ArrayList<Long>();
    do {
      MtasTreeItem checkItem = checkList.remove(checkList.size() - 1);
      advanceMtasTree(checkItem, position, in, isSinglePoint,
          isStoreAdditonalId, objectRefApproxOffset, list, nodeRefApproxOffset,
          checkList);
      history.add(checkItem.ref);
      if (history.size() > 1000) {
        throw new IOException(
            "ADVANCE " + position + " " + checkList + "\n" + history);
      }
    } while (checkList.size() > 0);
    return list;
  }
249566
def interpolate_using_previous(pointlist):
    '''
    
    '''
    pl = pointlist # alias
    npl = [] # new, interpolated pointlist

    if len(pl) < 1:
        raise InterpolationError('Empty list cannot be interpolated')

    first_nonnull = [None, None]

    # Find first non-nulls
    for i in [0, 1]:
        for p in pl:
            if p[i] is not None:
                first_nonnull[i] = p[i]
                break

    if first_nonnull[0] == None or first_nonnull[1] == None:
        # No good values found for every key
        raise InterpolationError('No non-null values to interpolate against: ' + str(first_nonnull))

    prev_nonnull = first_nonnull

    for p in pl:
        np = list(p)  # Copy point, this way we avoid modifying the original.
        for k in [0, 1]:
            if np[k] is None:
                np[k] = prev_nonnull[k]
            else:
                prev_nonnull[k] = np[k]
        npl.append(np)

    return npl
362974
private static int add1OrIncrement(String name, Map<String, Integer> map) {
        Integer old = map.get(name);
        int index = old == null ? 1 : old.intValue() + 1;
        map.put(name, Integer.valueOf(index));
        return index;
    }
982657
function offset(a,b,va,vb) {
				return abOffset[a * N + b] + va * params[b].n + vb;
			}
1313765
void appendOp(int length, int op)
  {

    int totalLen = m_ops.getOp(OpMap.MAPINDEX_LENGTH);

    m_ops.setOp(totalLen, op);
    m_ops.setOp(totalLen + OpMap.MAPINDEX_LENGTH, length);
    m_ops.setOp(OpMap.MAPINDEX_LENGTH, totalLen + length);
  }
289200
function splitListItem(opts: Options, change: Change): Change {
    const { value } = change;
    const currentItem = getCurrentItem(opts, value);
    if (!currentItem) {
        return change;
    }

    const splitOffset = value.startOffset;

    return change.splitDescendantsByKey(
        currentItem.key,
        value.startKey,
        splitOffset
    );
}
197597
def move_to(self, id_):
        """"""
        if self.items:
            try:
                self.current_item = self.items[id_]
            except (StopIteration, IndexError, NoSuchItem):
                raise NoSuchItem
            for f in self._hooks["select"]:
                f(self, id_)
        return self
209968
private static int lastIndexOf(Object o, Object[] elements, int index) {
        if (o == null) {
            for (int i = index; i >= 0; i--)
                if (elements[i] == null)
                    return i;
        } else {
            for (int i = index; i >= 0; i--)
                if (o.equals(elements[i]))
                    return i;
        }
        return -1;
    }
472130
def reindex(self):
        ''''''
        for i in range(self.count()):
            w = self.wpoints[i]
            w.seq = i
        self.last_change = time.time()
662902
private static <A, B> Map<A, B> listToMap(List<Map.Entry<A, B>> list) {
    Map<A, B> result = new LinkedHashMap<A, B>();
    for (Iterator<Map.Entry<A, B>> it = list.iterator(); it.hasNext();) {
      Map.Entry<A, B> entry = (Map.Entry<A, B>) it.next();
      result.put(entry.getKey(), entry.getValue());
    }
    return result;
  }
198245
def _offset_for(self, param):
        
        if param.has_parent():
            p = param._parent_._get_original(param)
            if p in self.parameters:
                return reduce(lambda a,b: a + b.size, self.parameters[:p._parent_index_], 0)
            return self._offset_for(param._parent_) + param._parent_._offset_for(param)
        return 0
779769
static int indexOfImpl(List<?> list, @Nullable Object element) {
    ListIterator<?> listIterator = list.listIterator();
    while (listIterator.hasNext()) {
      if (Objects.equal(element, listIterator.next())) {
        return listIterator.previousIndex();
      }
    }
    return -1;
  }
1070220
def pivot(self):
        
        self.op_data = [list(i) for i in zip(*self.ip_data)]
676759
def add(self, original_index, operation):
        
        self.index_map.append(original_index)
        self.ops.append(operation)
835711
private String getNextListIndexSuffix(Map<String, String> options, String key) {
        if (!options.containsKey(key)) {
            return "";
        } else {
            int i = 1;
            while (options.containsKey(key + "." + i)) {
                i++;
            }
            return "." + i;
        }
    }
624920
def cut(list_, index=0):
    """"""
    if isinstance(index, int):
        cut_ = lambda x: x[index]
    else:
        cut_ = lambda x: getattr(x, index)
    return list(map(cut_, list_))