public int indexOf(Object o) { ISeq s = seq(); for (int i = 0; s != null; s = s.next(), i++) { if (Util.equiv(s.first(), o)) return i; } return -1; }
public boolean equiv(Object obj) { if (!(obj instanceof Map)) return false; if (obj instanceof IPersistentMap && !(obj instanceof MapEquivalence)) return false; Map m = (Map) obj; if (m.size() != size()) return false; for (ISeq s = seq(); s != null; s = s.next()) { Map.Entry e = (Map.Entry) s.first(); boolean found = m.containsKey(e.getKey()); if (!found || !Util.equiv(e.getValue(), m.get(e.getKey()))) return false; } return true; }
public boolean contains(Object o) { for (ISeq s = seq(); s != null; s = s.next()) { if (Util.equiv(s.first(), o)) return true; } return false; }