

from org.gvsig.fmap.dal.feature.impl.featureset import DefaultFeatureSet as JFeatureSet
        

class JavaIteratorWraper(object):
    def __init__(self, jiterator):
        self._jiterator = jiterator

    def next(self):
        if self._jiterator.hasNext():
            return self._jiterator.next()
        raise StopIteration()

def __iter(self):
    return JavaIteratorWraper(self.iterator())

def __len(self):
  return self.getSize()

#
# Inject new methods in the class JFeatureSet
#
#JFeatureSet.__iter__ = __iter
JFeatureSet.__len__ = __len


