MCPcopy Index your code
hub / github.com/clojure/clojure / doEquiv

Method doEquiv

src/jvm/clojure/lang/APersistentVector.java:89–134  ·  view source on GitHub ↗
(IPersistentVector v, Object obj)

Source from the content-addressed store, hash-verified

87}
88
89static boolean doEquiv(IPersistentVector v, Object obj){
90 if(obj instanceof IPersistentVector)
91 {
92 IPersistentVector ov = (IPersistentVector) obj;
93 if(ov.count() != v.count())
94 return false;
95 for(int i = 0;i< v.count();i++)
96 {
97 if(!Util.equiv(v.nth(i), ov.nth(i)))
98 return false;
99 }
100 return true;
101 }
102 else if(obj instanceof List)
103 {
104 Collection ma = (Collection) obj;
105
106 if((!(ma instanceof IPersistentCollection) || (ma instanceof Counted)) && (ma.size() != v.count()))
107 return false;
108
109 Iterator i2 = ma.iterator();
110
111 for(Iterator i1 = ((List) v).iterator(); i1.hasNext();)
112 {
113 if(!i2.hasNext() || !Util.equiv(i1.next(), i2.next()))
114 return false;
115 }
116 return !i2.hasNext();
117 }
118 else
119 {
120 if(!(obj instanceof Sequential))
121 return false;
122 ISeq ms = RT.seq(obj);
123 for(int i = 0; i < v.count(); i++, ms = ms.next())
124 {
125 if(ms == null || !Util.equiv(v.nth(i), ms.first()))
126 return false;
127 }
128 if(ms != null)
129 return false;
130 }
131
132 return true;
133
134}
135
136public boolean equals(Object obj){
137 if(obj == this)

Callers 1

equivMethod · 0.95

Calls 9

equivMethod · 0.95
nextMethod · 0.95
seqMethod · 0.95
firstMethod · 0.95
countMethod · 0.65
nthMethod · 0.65
iteratorMethod · 0.65
sizeMethod · 0.45
hasNextMethod · 0.45

Tested by

no test coverage detected