<commit_before>Index: util/Hashmap.class.php
===================================================================
--- util/Hashmap.class.php	(Revision 10599)
+++ util/Hashmap.class.php	(Arbeitskopie)
@@ -49,7 +49,7 @@
     }
 
     /**
-     * Returns an iterator over the keys of this hashmap
+     * Returns an iterator over the values of this hashmap
      *
      * @return  util.HashmapIterator
      * @see     xp://util.HashmapIterator
@@ -59,6 +59,16 @@
     }
         
     /**
+     * Returns an iterator over the keys of this hashmap
+     *
+     * @return  util.HashmapIterator
+     * @see     xp://util.HashmapIterator
+     */
+    public function keyIterator() {
+      return new HashmapIterator(array_keys($this->_hash));
+    }
+        
+    /**
      * Sort this hashmap
      *
      * The flags parameter may be used to influence the sorting<commit_msg>- strange behaviour with empty input<commit_after>Index: skeleton/util/Hashmap.class.php
===================================================================
--- skeleton/util/Hashmap.class.php	(Revision 10599)
+++ skeleton/util/Hashmap.class.php	(Arbeitskopie)
@@ -49,7 +49,7 @@
     }
 
     /**
-     * Returns an iterator over the keys of this hashmap
+     * Returns an iterator over the values of this hashmap
      *
      * @return  util.HashmapIterator
      * @see     xp://util.HashmapIterator
@@ -59,6 +59,16 @@
     }
         
     /**
+     * Returns an iterator over the keys of this hashmap
+     *
+     * @return  util.HashmapIterator
+     * @see     xp://util.HashmapIterator
+     */
+    public function keyIterator() {
+      return new HashmapIterator(array_keys($this->_hash));
+    }
+        
+    /**
      * Sort this hashmap
      *
      * The flags parameter may be used to influence the sorting
Index: skeleton/util/HashmapIterator.class.php
===================================================================
--- skeleton/util/HashmapIterator.class.php	(Revision 10599)
+++ skeleton/util/HashmapIterator.class.php	(Arbeitskopie)
@@ -36,6 +36,7 @@
     public function __construct($hash) {
       $this->_hash= (array) $hash;
       reset($this->_hash);
+      $this->_key= key($this->_hash);
     }
   
     /**
@@ -46,7 +47,7 @@
      * @return  bool
      */
     public function hasNext() {
-      return !is_null($this->_key= key($this->_hash));
+      return !is_null($this->_key);
     }
     
     /**
@@ -56,11 +57,11 @@
      * @throws  util.NoSuchElementException when there are no more elements
      */
     public function next() {
-      if (is_null($this->_key)) {
-        throw(new NoSuchElementException('No more elements'));
-      }
+      if (is_null($this->_key)) throw(new NoSuchElementException('No more elements'));
+      $oldkey= $this->_key;
       next($this->_hash);
-      return $this->_hash[$this->_key];
+      $this->_key= key($this->_hash);
+      return $this->_hash[$oldkey];
     }
   } 
 ?>
{'fraction_non_alphanumeric': 0.2074124447466848, 'fraction_numerical': 0.02074124447466848, 'mean_word_length': 2.540312876052948, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2939509', 'n_tokens_mistral': 946, 'n_tokens_neox': 878, 'n_words': 198}