decodeCollectionSize

open fun decodeCollectionSize(descriptor: SerialDescriptor): Int

Method to decode collection size that may be called before the collection decoding. Collection type includes Collection, Map and Array (including primitive arrays). Method can return -1 if the size is not known in advance, though for sequential decoding knowing precise size is a mandatory requirement.