(ByteBuffer o)
| 83 | } |
| 84 | |
| 85 | public int compareTo(ByteBuffer o) { |
| 86 | int end = (remaining() < o.remaining() ? remaining() : o.remaining()); |
| 87 | |
| 88 | for (int i = 0; i < end; ++i) { |
| 89 | int d = get(position + i) - o.get(o.position + i); |
| 90 | if (d != 0) { |
| 91 | return d; |
| 92 | } |
| 93 | } |
| 94 | return remaining() - o.remaining(); |
| 95 | } |
| 96 | |
| 97 | public boolean equals(Object o) { |
| 98 | return o instanceof ByteBuffer && compareTo((ByteBuffer) o) == 0; |