design iterator support peek operation exist iterator addition hasnext operationsimplement PeekingIterator classpeekingiteratoriteratorint num Initializes object give integer iterator iteratorint Returns element array move pointer elementboolean hasnext return true element arrayint peek Returns element array move pointerNote each language different implementation constructor Iterator support int boolean hasnext function Example 1inputpeekingiterator peek hasNext1 2 3 outputnull 1 2 2 3 falseexplanationpeekingiterator peekingiterator new PeekingIterator1 2 3 123peekingiteratornext return 1 pointer move element 123peekingiteratorpeek return 2 pointer 123peekingiteratornext return 2 pointer move element 123peekingiteratornext return 3 pointer move element 123peekingiteratorhasnext return false Constraints1 numslength 10001 numsi 1000all call peek validAt 1000 call hasnext peek Follow how extend design generic work type integer