diff --git a/smack-core/src/main/java/org/jivesoftware/smack/PacketCollector.java b/smack-core/src/main/java/org/jivesoftware/smack/PacketCollector.java
index ba78224ea..14111003b 100644
--- a/smack-core/src/main/java/org/jivesoftware/smack/PacketCollector.java
+++ b/smack-core/src/main/java/org/jivesoftware/smack/PacketCollector.java
@@ -166,6 +166,7 @@ public class PacketCollector {
* until a packet is available or the timeout has elapsed. If the
* timeout elapses without a result, null will be returned.
*
+ * @param timeout the timeout in milliseconds.
* @return the next available packet.
*/
@SuppressWarnings("unchecked")
@@ -218,6 +219,16 @@ public class PacketCollector {
return result;
}
+ /**
+ * Get the number of collected stanzas this packet collector has collected so far.
+ *
+ * @return the count of collected stanzas.
+ * @since 4.1
+ */
+ public int getCollectedCount() {
+ return resultQueue.size();
+ }
+
/**
* Processes a packet to see if it meets the criteria for this packet collector.
* If so, the packet is added to the result queue.