Skip to content

Commit 4f6253b

Browse files
committed
Change useless while to if
1 parent ae77ff9 commit 4f6253b

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/main/java/com/maxmind/db/MultiBuffer.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -272,15 +272,11 @@ public static MultiBuffer wrap(List<byte[]> chunks) {
272272
int offset = 0;
273273
int remaining = chunk.length;
274274

275-
while (remaining > 0) {
276-
int toPut = remaining;
277-
ByteBuffer buf = ByteBuffer.allocate(toPut);
278-
buf.put(chunk, offset, toPut);
275+
if (remaining > 0) {
276+
ByteBuffer buf = ByteBuffer.allocate(remaining);
277+
buf.put(chunk, offset, remaining);
279278
buf.flip();
280279
buffers.add(buf);
281-
282-
offset += toPut;
283-
remaining -= toPut;
284280
}
285281
}
286282

0 commit comments

Comments
 (0)