Make sure that iterator.next() validates that next element exists -
otherwise throw the exception specified by the interface.
Bug:
30096512
Change-Id: I327da433e3f1181e272c81ee503cbe8aab323f7e
import java.nio.ByteOrder;
import java.util.Arrays;
import java.util.Iterator;
+import java.util.NoSuchElementException;
/**
* Utility class to construct and parse byte arrays using the TLV format -
@Override
public TlvElement next() {
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+
int type = 0;
if (mTypeSize == 1) {
type = mArray[mOffset];