MCPcopy Create free account
hub / github.com/davidgiven/luje / equals

Method equals

lib/java/nio/DoubleBuffer.java:231–252  ·  view source on GitHub ↗

Checks whether this double buffer is equal to another object. If other is not a DoubleBuffer then false is returned. Two double buffers are equal if their remaining doubles are equal. Position, limit, capacity and mark are not considered. This method considers two dou

(Object other)

Source from the content-addressed store, hash-verified

229 * {@code false} otherwise.
230 */
231 @Override
232 public boolean equals(Object other) {
233 if (!(other instanceof DoubleBuffer)) {
234 return false;
235 }
236 DoubleBuffer otherBuffer = (DoubleBuffer) other;
237
238 if (remaining() != otherBuffer.remaining()) {
239 return false;
240 }
241
242 int myPosition = position;
243 int otherPosition = otherBuffer.position;
244 boolean equalSoFar = true;
245 while (equalSoFar && (myPosition < limit)) {
246 double a = get(myPosition++);
247 double b = otherBuffer.get(otherPosition++);
248 equalSoFar = a == b || (a != a && b != b);
249 }
250
251 return equalSoFar;
252 }
253
254 /**
255 * Returns the double at the current position and increases the position by

Callers

nothing calls this directly

Calls 2

getMethod · 0.95
remainingMethod · 0.80

Tested by

no test coverage detected