mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-10-18 19:48:46 +02:00
java: fixes CollectionTemplate
This commit is contained in:
@@ -31,10 +31,11 @@ public class CollectionTemplate implements Template {
|
||||
}
|
||||
|
||||
public void pack(Packer pk, Object target) throws IOException {
|
||||
if(target instanceof Collection) {
|
||||
if(!(target instanceof Collection)) {
|
||||
throw new MessageTypeException();
|
||||
}
|
||||
Collection<Object> collection = (Collection<Object>)target;
|
||||
pk.packArray(collection.size());
|
||||
for(Object element : collection) {
|
||||
elementTemplate.pack(pk, element);
|
||||
}
|
||||
|
Reference in New Issue
Block a user