Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
  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;
  }
Exemplo n.º 3
0
 public boolean contains(Object o) {
   for (ISeq s = seq(); s != null; s = s.next()) {
     if (Util.equiv(s.first(), o)) return true;
   }
   return false;
 }