How to iterate through a Map in java?
问题 I need to iterate through a BucketMap and get all keys but how do I get to something like buckets[i].next.next.next.key for instance without doing it manually as I tried here: public String[] getAllKeys() { int j = 0; //index of string array "allkeys" String allkeys[] = new String[8]; for(int i = 0; i < buckets.length; i++) { //iterates through the bucketmap if(buckets[i] != null) { //checks wether bucket has a key and value allkeys[j] = buckets[i].key; //adds key to allkeys j++; // counts up