public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof KVComparator) { return cmp.equals(((KVComparator) o).cmp); } return false; }
@ExposedMethod(doc = BuiltinDocs.list_count_doc) final synchronized int list_count(PyObject o) { int count = 0; for (PyObject item : list) { if (item.equals(o)) { count++; } } return count; }
private int _index(PyObject o, String message, int start, int stop) { // Follow Python 2.3+ behavior int validStop = boundToSequence(stop); int validStart = boundToSequence(start); int i = validStart; if (validStart <= validStop) { try { for (PyObject item : list.subList(validStart, validStop)) { if (item.equals(o)) { return i; } i++; } } catch (ConcurrentModificationException ex) { throw Py.ValueError(message); } } throw Py.ValueError(message); }