From 418c81542b9a907af1e2cfabea78f8409525cac4 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Fri, 10 Apr 2015 09:43:06 +0200 Subject: [PATCH] Let CompositeByteBuf implement Iterable Motivation: CompositeByteBuf has an iterator() method but fails to implement Iterable Modifications: Let CompositeByteBuf implement Iterable Result: Easier usage --- buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java b/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java index 944ad434a4..095e534110 100644 --- a/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java +++ b/buffer/src/main/java/io/netty/buffer/CompositeByteBuf.java @@ -37,7 +37,7 @@ import java.util.ListIterator; * {@link ByteBufAllocator#compositeBuffer()} or {@link Unpooled#wrappedBuffer(ByteBuf...)} instead of calling the * constructor explicitly. */ -public class CompositeByteBuf extends AbstractReferenceCountedByteBuf { +public class CompositeByteBuf extends AbstractReferenceCountedByteBuf implements Iterable { private static final ByteBuffer EMPTY_NIO_BUFFER = Unpooled.EMPTY_BUFFER.nioBuffer(); @@ -371,6 +371,7 @@ public class CompositeByteBuf extends AbstractReferenceCountedByteBuf { return this; } + @Override public Iterator iterator() { ensureAccessible(); List list = new ArrayList(components.size());