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

Method equals

lib/java/nio/ShortBuffer.java:225–244  ·  view source on GitHub ↗

Checks whether this short buffer is equal to another object. If other is not a short buffer then false is returned. Two short buffers are equal if and only if their remaining shorts are exactly the same. Position, limit, capacity and mark are not considered. @param other

(Object other)

Source from the content-addressed store, hash-verified

223 * {@code false} otherwise.
224 */
225 @Override
226 public boolean equals(Object other) {
227 if (!(other instanceof ShortBuffer)) {
228 return false;
229 }
230 ShortBuffer otherBuffer = (ShortBuffer) other;
231
232 if (remaining() != otherBuffer.remaining()) {
233 return false;
234 }
235
236 int myPosition = position;
237 int otherPosition = otherBuffer.position;
238 boolean equalSoFar = true;
239 while (equalSoFar && (myPosition < limit)) {
240 equalSoFar = get(myPosition++) == otherBuffer.get(otherPosition++);
241 }
242
243 return equalSoFar;
244 }
245
246 /**
247 * Returns the short 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