|
@@ -69,7 +69,7 @@ namespace Framework
|
|
|
int index = abs( hash( key ) ) % bucketCount;
|
|
|
if( !buckets[ index ] )
|
|
|
buckets[ index ] = new Array< MapEntry<K, V>>();
|
|
|
- for( auto iterator = buckets[ index ]->getIterator(); iterator; iterator++ )
|
|
|
+ for( auto iterator = buckets[ index ]->begin(); iterator; iterator++ )
|
|
|
{
|
|
|
if( iterator._.getKey() == key )
|
|
|
{
|
|
@@ -86,13 +86,14 @@ namespace Framework
|
|
|
if( !buckets[ index ] )
|
|
|
return;
|
|
|
int listIndex = 0;
|
|
|
- for( auto iterator = buckets[ index ]->getIterator(); iterator; iterator++, listIndex++ )
|
|
|
+ for( auto bucket : *buckets[ index ] )
|
|
|
{
|
|
|
- if( iterator._.getKey() == key )
|
|
|
+ if( bucket.getKey() == key )
|
|
|
{
|
|
|
- buckets[ index ]->remove( listIndex );
|
|
|
+ bucket.remove( listIndex );
|
|
|
return;
|
|
|
}
|
|
|
+ listIndex++;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -101,10 +102,10 @@ namespace Framework
|
|
|
int index = abs( hash( key ) ) % bucketCount;
|
|
|
if( !buckets[ index ] )
|
|
|
throw "element not found";
|
|
|
- for( auto iterator = buckets[ index ]->getIterator(); iterator; iterator++ )
|
|
|
+ for( auto iterator : *buckets[ index ] )
|
|
|
{
|
|
|
- if( iterator._.getKey() == key )
|
|
|
- return iterator._.getValue();
|
|
|
+ if( iterator.getKey() == key )
|
|
|
+ return iterator.getValue();
|
|
|
}
|
|
|
throw "element not found";
|
|
|
}
|
|
@@ -114,10 +115,10 @@ namespace Framework
|
|
|
int index = abs( hash( key ) ) % bucketCount;
|
|
|
if( !buckets[ index ] )
|
|
|
return fallback;
|
|
|
- for( auto iterator = buckets[ index ]->getIterator(); iterator; iterator++ )
|
|
|
+ for( auto bucket : *buckets[ index ] )
|
|
|
{
|
|
|
- if( iterator._.getKey() == key )
|
|
|
- return iterator._.getValue();
|
|
|
+ if( bucket.getKey() == key )
|
|
|
+ return bucket.getValue();
|
|
|
}
|
|
|
return fallback;
|
|
|
}
|
|
@@ -127,9 +128,9 @@ namespace Framework
|
|
|
int index = abs( hash( key ) ) % bucketCount;
|
|
|
if( !buckets[ index ] )
|
|
|
return 0;
|
|
|
- for( auto iterator = buckets[ index ]->getIterator(); iterator; iterator++ )
|
|
|
+ for( auto bucket : buckets[ index ] )
|
|
|
{
|
|
|
- if( iterator._.getKey() == key )
|
|
|
+ if( bucket.getKey() == key )
|
|
|
return 1;
|
|
|
}
|
|
|
return 0;
|