[2.2.1] Apply reviewed header file (Base to Collection)
[platform/framework/native/appfw.git] / inc / FBaseColHashMapT.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file                FBaseColHashMapT.h
19  * @brief               This is the header file for the %HashMapT class.
20  *
21  * This header file contains the declarations of the %HashMapT class.
22  */
23 #ifndef _FBASE_COL_HASH_MAP_T_H_
24 #define _FBASE_COL_HASH_MAP_T_H_
25
26 #include <FBaseObject.h>
27 #include <FBaseResult.h>
28 #include <FBaseColIComparerT.h>
29 #include <FBaseColIHashCodeProviderT.h>
30 #include <FBaseColIListT.h>
31 #include <FBaseColIMapT.h>
32 #include <FBaseColArrayListT.h>
33 #include <FBaseColMapEntryT.h>
34 #include <FBaseComparerT.h>
35 #include <FBaseFloat.h>
36
37 namespace Tizen { namespace Base { namespace Collection
38 {
39
40 template< class KeyType, class ValueType > class __HashMapEntryT;
41 template< class KeyType, class ValueType > class __HashMapEnumeratorT;
42 template< class KeyType > class __HashMapDefaultProviderT;
43
44 /**
45  * @class HashMapT
46  * @brief This class provides a template-based collection of associated keys and values
47  * that are organized based on the hash code of the key.
48  *
49  * @since 2.0
50  *
51  * The %HashMapT class provides a template-based collection of associated keys and values
52  * that are organized based on the hash code of the key.
53  * It contains unique keys and each key maps to one single value.
54  * The key and value cannot be a @c null reference. Several methods in the %HashMapT class need the assignment (=) operators of the KeyType and the ValueType.
55  * @n
56  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/base/hashmap_multihashmap.htm">HashMap and MultiHashMap</a>.
57  *
58  * The following example demonstrates how to use the %HashMapT class.
59
60  * @code
61  *      #include <FBase.h>
62  *
63  *      using namespace Tizen::Base;
64  *      using namespace Tizen::Base::Collection;
65  *
66  *      void
67  *      MyClass::HashMapTSample(void)
68  *      {
69  *              HashMapT< int, int > map;
70  *
71  *              // Constructs a %HashMapT instance with default capacity, load factor, hash code provider, and comparer
72  *              map.Construct();
73  *
74  *              map.Add(1, 100);        // map.GetCount() : 1
75  *              map.Add(2, 200);        // map.GetCount() : 2
76  *              map.Add(3, 300);        // map.GetCount() : 3
77  *
78  *              int key;
79  *              int value;
80  *
81  *              // Gets a value with the specified key
82  *              key = 1;
83  *              map.GetValue(key, value);       // value : 100
84  *
85  *              // Removes the value with the specified key
86  *              map.Remove(key);
87  *
88  *              // Uses an enumerator to access elements in the map
89  *              IMapEnumeratorT< int, int >*    pMapEnum = map.GetMapEnumeratorN();
90  *              while (pMapEnum->MoveNext() == E_SUCCESS)
91  *              {
92  *                      pMapEnum->GetKey(key);
93  *                      pMapEnum->GetValue(value);
94  *              }
95  *
96  *              delete pMapEnum;
97  *      }
98  * @endcode
99  */
100 template< class KeyType, class ValueType >
101 class HashMapT
102         : public IMapT< KeyType, ValueType >
103         , public Object
104 {
105 public:
106         /**
107          * The object is not fully constructed after this constructor is called. For full construction, @n
108          * the Construct() method must be called right after calling this constructor.
109          *
110          * @since 2.0
111          */
112         HashMapT(void)
113                 : __pTable(null)
114                 , __count(0)
115                 , __capacity(0)
116                 , __loadFactor(0)
117                 , __threshold(0)
118                 , __pProvider(null)
119                 , __pComparer(null)
120                 , __defaultConstruct(false)
121                 , __modCount(0)
122         {
123         }
124
125         /**
126          * This destructor overrides Tizen::Base::Object::~Object().
127          *
128          * @since 2.0
129          */
130         virtual ~HashMapT(void)
131         {
132                 if (null != __pTable)
133                 {
134                         Reset();
135                         delete[] __pTable;
136                 }
137
138                 if (__defaultConstruct)
139                 {
140                         delete __pProvider;
141                         delete __pComparer;
142                 }
143
144         }
145
146         /**
147          * Initializes this instance of %HashMapT with the specified parameters.
148          *
149          * @since 2.0
150          *
151          * @return              An error code
152          * @param[in]   capacity                The initial capacity
153          * @param[in]   loadFactor              The maximum ratio of elements to buckets
154          * @exception   E_SUCCESS               The method is successful.
155          * @exception   E_INVALID_ARG   Either of the following conditions has occurred:
156          *                                                              - A specified input parameter is invalid.
157          *                                                              - The specified @c capacity or the specified @c loadFactor is negative.
158          * @remarks             To work properly, the key type must be of a primitive number type.
159          * @see                 HashMapT()
160          */
161         result Construct(int capacity = 16, float loadFactor = 0.75)
162         {
163                 TryReturn(capacity >= 0, E_INVALID_ARG, "[%s] The capacity(%d) MUST be greater than or equal to 0.", GetErrorMessage(E_INVALID_ARG), capacity);
164                 TryReturn(loadFactor >= 0, E_INVALID_ARG, "[%s] The loadFactor(%f) MUST be greater than or equal to 0.0.", GetErrorMessage(E_INVALID_ARG), loadFactor);
165
166                 result r = E_SUCCESS;
167
168                 if (capacity == 0)
169                 {
170                         __capacity = DEFAULT_CAPACITY;
171                 }
172                 else
173                 {
174                         __capacity = 1;
175                         while (__capacity < capacity)
176                         {
177                                 __capacity <<= 1;
178                         }
179                 }
180
181                 if (Float::Compare(loadFactor, 0) == 0)
182                 {
183                         __loadFactor = DEFAULT_LOAD_FACTOR;
184                 }
185                 else
186                 {
187                         __loadFactor = loadFactor;
188                 }
189
190                 __threshold = static_cast< int >(__capacity * __loadFactor);
191
192                 __pProvider = new __HashMapDefaultProviderT< KeyType >();
193                 TryCatch(__pProvider != null, r = E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
194
195                 __pComparer = new Tizen::Base::ComparerT< KeyType >();
196                 TryCatch(__pComparer != null, r = E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
197
198                 __defaultConstruct = true;
199
200                 __pTable = new __HashMapEntryT< KeyType, ValueType >*[__capacity];
201                 TryCatch(__pTable != null, r = E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
202
203                 memset(__pTable, null, sizeof(__HashMapEntryT< KeyType, ValueType >*) * __capacity);
204
205                 return r;
206
207 CATCH:
208                 __capacity = 0;
209                 delete __pProvider;
210                 delete __pComparer;
211
212                 return r;
213         }
214
215         /**
216          * Initializes this instance of %HashMapT by copying the elements of the specified @c map.
217          *
218          * @since 2.0
219          *
220          * @return              An error code
221          * @param[in]   map                                     The map to copy
222          * @param[in]   loadFactor                      The maximum ratio of elements to buckets
223          * @exception   E_SUCCESS                       The method is successful.
224          * @exception   E_INVALID_ARG           Either of the following conditions has occurred:
225          *                                                                      - A specified input parameter is invalid.
226          *                                                                      - The specified @c loadFactor is negative.
227          * @exception   E_INVALID_OPERATION     Either of the following conditions has occurred:
228          *                                                                      - The current state of the instance prohibits the execution of the specified operation.
229          *                                                                      - The specified @c map is modified during the operation of this method.
230          * @see                 HashMapT()
231          */
232         result Construct(const IMapT< KeyType, ValueType >& map, float loadFactor = 0.75)
233         {
234                 TryReturn(loadFactor >= 0, E_INVALID_ARG, "[%s] The loadFactor(%f) MUST be greater than or equal to 0.0.", GetErrorMessage(E_INVALID_ARG), loadFactor);
235
236                 result r = E_SUCCESS;
237
238                 if (Float::Compare(loadFactor, 0) == 0)
239                 {
240                         loadFactor = DEFAULT_LOAD_FACTOR;
241                 }
242
243                 int capacity = static_cast< int >(map.GetCount() / loadFactor) + 1;
244
245                 r = Construct(capacity, loadFactor);
246                 TryCatch(r == E_SUCCESS, , "[%s] Propagating.", GetErrorMessage(r));
247
248                 r = AddAll(map);
249                 TryCatch(r == E_SUCCESS, , "[%s] Propagating.", GetErrorMessage(r));
250
251                 return r;
252
253 CATCH:
254                 Reset();
255                 delete[] __pTable;
256                 __pTable = null;
257
258                 __capacity = 0;
259
260                 delete __pProvider;
261                 __pProvider = null;
262
263                 delete __pComparer;
264                 __pComparer = null;
265
266                 return r;
267         }
268
269         /**
270          * Initializes this instance of the empty %HashMapT, with the specified initial capacity, load factor, hash code provider, and comparer.
271          *
272          * @since 2.0
273          *
274          * @return              An error code
275          * @param[in]   capacity                The initial capacity @n
276          *                                                              If it is @c 0, the default capacity (16) is used.
277          * @param[in]   loadFactor              The maximum ratio of the elements to buckets @n
278          *                                                              If it is @c 0, the default load factor (0.75) is used.
279          * @param[in]   provider                An instance of the IHashCodeProviderT-derived class that supplies the hash codes
280          *                                                              for all the keys in this map
281          * @param[in]   comparer                An instance of the IComparerT-derived class to use when comparing the keys
282          * @exception   E_SUCCESS               The method is successful.
283          * @exception   E_INVALID_ARG   Either of the following conditions has occurred:
284          *                                                              - A specified input parameter is invalid.
285          *                                                              - The specified @c capacity is negative.
286          *                                                              - The specified @c loadFactor is negative.
287          * @remarks             The instances of the hash code provider and the comparer are not deallocated later from this map.
288          * @see                 HashMapT()
289          */
290         result Construct(int capacity, float loadFactor, const IHashCodeProviderT< KeyType >& provider,
291                                          const IComparerT< KeyType >& comparer)
292         {
293                 TryReturn(capacity >= 0, E_INVALID_ARG, "[%s] The capacity(%d) MUST be greater than or equal to 0.", GetErrorMessage(E_INVALID_ARG), capacity);
294                 TryReturn(loadFactor >= 0, E_INVALID_ARG, "[%s] The loadFactor(%f) MUST be greater than or equal to 0.0.", GetErrorMessage(E_INVALID_ARG), loadFactor);
295
296                 result r = E_SUCCESS;
297
298                 if (capacity == 0)
299                 {
300                         __capacity = DEFAULT_CAPACITY;
301                 }
302                 else
303                 {
304                         __capacity = 1;
305                         while (__capacity < capacity)
306                         {
307                                 __capacity <<= 1;
308                         }
309                 }
310
311                 if (Float::Compare(loadFactor, 0) == 0)
312                 {
313                         __loadFactor = DEFAULT_LOAD_FACTOR;
314                 }
315                 else
316                 {
317                         __loadFactor = loadFactor;
318                 }
319
320                 __threshold = static_cast< int >(__capacity * __loadFactor);
321
322                 __pProvider = const_cast< IHashCodeProviderT< KeyType >* >(&provider);
323
324                 __pComparer = const_cast< IComparerT< KeyType >* >(&comparer);
325
326                 __pTable = new __HashMapEntryT< KeyType, ValueType >*[__capacity];
327                 TryCatch(__pTable != null, r = E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
328
329                 memset(__pTable, null, sizeof(__HashMapEntryT< KeyType, ValueType >*) * __capacity);
330
331                 return r;
332
333 CATCH:
334                 __capacity = 0;
335                 __pProvider = null;
336                 __pComparer = null;
337
338                 return r;
339         }
340
341         /**
342          * Initializes this instance of %HashMapT by copying the elements of the specified @c map,
343          * with the specified load factor, hash code provider, and comparer.
344          *
345          * @since 2.0
346          *
347          * @return              An error code
348          * @param[in]   map                                     The map to copy
349          * @param[in]   loadFactor                      The maximum ratio of elements to buckets @n
350          *                                                                      If it is @c 0, the default load factor (0.75) is used.
351          * @param[in]   provider                        An instance of the IHashCodeProviderT-derived class that supplies the hash codes
352          *                                                                      for all the keys in this map
353          * @param[in]   comparer                        An instance of the IComparerT-derived class to use when comparing the keys
354          * @exception   E_SUCCESS                       The method is successful.
355          * @exception   E_INVALID_ARG           Either of the following conditions has occurred:
356          *                                                                      - A specified input parameter is invalid.
357          *                                                                      - The specified @c loadFactor is negative.
358          *                                                                      - Either the specified @c provider or the specified @c comparer is @c null.
359          * @exception   E_INVALID_OPERATION     Either of the following conditions has occurred:
360          *                                                                      - The current state of the instance prohibits the execution of the specified operation.
361          *                                                                      - The specified @c map is modified during the operation of this method.
362          * @remarks             The instances of the hash code provider and the comparer are not deallocated later from this map.
363          * @see                 HashMapT()
364          */
365         result Construct(const IMapT< KeyType, ValueType >& map, float loadFactor, const IHashCodeProviderT< KeyType >& provider,
366                                          const IComparerT< KeyType >& comparer)
367         {
368                 TryReturn((loadFactor >= 0), E_INVALID_ARG, "[%s] The loadFactor(%f) MUST be greater than or equal to 0.0.", GetErrorMessage(E_INVALID_ARG), loadFactor);
369
370                 result r = E_SUCCESS;
371                 if (Float::Compare(loadFactor, 0) == 0)
372                 {
373                         loadFactor = DEFAULT_LOAD_FACTOR;
374                 }
375
376                 int capacity = static_cast< int >(map.GetCount() / loadFactor) + 1;
377                 r = Construct(capacity, loadFactor, provider, comparer);
378                 TryCatch(r == E_SUCCESS, , "[%s] Propagating.", GetErrorMessage(r));
379
380                 r = AddAll(map);
381                 TryCatch(r == E_SUCCESS, , "[%s] Propagating.", GetErrorMessage(r));
382
383                 return r;
384
385 CATCH:
386                 Reset();
387                 delete[] __pTable;
388                 __pTable = null;
389
390                 __capacity = 0;
391                 __pProvider = null;
392                 __pComparer = null;
393
394                 return r;
395         }
396
397         /**
398          * Adds the specified key-value pair to the map.
399          *
400          * @since 2.0
401          *
402          * @return              An error code
403          * @param[in]   key                                     The key of the value to add
404          * @param[in]   value                           The value to add
405          * @exception   E_SUCCESS                       The method is successful.
406          * @exception   E_INVALID_ARG           Either of the following conditions has occurred:
407          *                                                                      - A specified input parameter is invalid.
408          *                                                                      - The comparer has failed to compare the keys.
409          * @exception   E_OBJ_ALREADY_EXIST     The specified @c key already exists.
410          * @see Remove()
411          */
412         virtual result Add(const KeyType& key, const ValueType& value)
413         {
414                 __HashMapEntryT< KeyType, ValueType >* pNewEntry;
415
416                 result r = E_SUCCESS;
417                 int hash = Hash(key);
418                 int i = hash & (__capacity - 1);
419                 bool out = false;
420
421                 r = ContainsKey(key, out);
422                 TryReturn((!out), E_OBJ_ALREADY_EXIST, "[%s] The key is already exist in this collection.", GetErrorMessage(E_OBJ_ALREADY_EXIST));
423                 TryReturn(r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
424
425                 r = E_SUCCESS;
426                 pNewEntry = new __HashMapEntryT< KeyType, ValueType >(key, value, __pTable[i], hash);
427                 TryReturn(pNewEntry != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
428                 __pTable[i] = pNewEntry;
429                 __modCount++;
430
431                 if (__count++ >= __threshold)
432                 {
433                         r = Resize(__capacity * 2);
434                         TryReturn(r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
435                 }
436
437                 return E_SUCCESS;
438         }
439
440         /**
441          * Gets the elements of the map through an instance of the IMapEnumeratorT-derived class.
442          *
443          * @since 2.0
444          *
445          * @return              An instance of the IMapEnumeratorT-derived class, @n
446          *                              else @c null if an exception occurs
447          * @exception   E_SUCCESS               The method is successful.
448          * @exception   E_OUT_OF_MEMORY The memory is insufficient.
449          * @remarks             The specific error code can be accessed using the GetLastResult() method.
450          * @see                 Tizen::Base::Collection::IEnumerator
451          * @see                 Tizen::Base::Collection::IMapEnumerator
452          */
453         virtual IEnumeratorT< MapEntryT< KeyType, ValueType > >* GetEnumeratorN(void) const
454         {
455                 result r = E_SUCCESS;
456
457                 __HashMapEnumeratorT< KeyType, ValueType >* pEnum = new __HashMapEnumeratorT< KeyType, ValueType >(*this, __modCount);
458                 TryCatch(pEnum != null, r = E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
459
460                 SetLastResult(E_SUCCESS);
461                 return pEnum;
462
463 CATCH:
464                 SetLastResult(r);
465                 return null;
466         }
467
468         /**
469          * Gets the elements of the map through an instance of the IMapEnumeratorT class.
470          *
471          * @since 2.0
472          *
473          * @return              An instance of the IMapEnumeratorT class, @n
474          *                              else @c null if an exception occurs
475          * @exception   E_SUCCESS               The method is successful.
476          * @exception   E_OUT_OF_MEMORY The memory is insufficient.
477          * @remarks             The specific error code can be accessed using the GetLastResult() method.
478          * @see                 Tizen::Base::Collection::IEnumerator
479          * @see                 Tizen::Base::Collection::IMapEnumerator
480          */
481         virtual IMapEnumeratorT< KeyType, ValueType >* GetMapEnumeratorN(void) const
482         {
483                 return dynamic_cast< IMapEnumeratorT< KeyType, ValueType >* >(GetEnumeratorN());
484         }
485
486         /**
487          * Gets the value associated with the specified @c key.
488          *
489          * @since 2.0
490          *
491          * @return              The value associated with the key, @n
492          *                              else @c null if an exception occurs
493          * @param[in]   key                                     The key to locate
494          * @param[out]  value                           The value associated with the @c key
495          * @exception   E_SUCCESS                       The method is successful.
496          * @exception   E_INVALID_ARG           Either of the following conditions has occurred:
497          *                                                                      - A specified input parameter is invalid.
498          *                                                                      - The comparer has failed to compare the keys.
499          * @exception   E_OBJ_NOT_FOUND         The specified @c key has not been found in the map.
500          * @see                 SetValue()
501          */
502         virtual result GetValue(const KeyType& key, ValueType& value) const
503         {
504                 result r = E_OBJ_NOT_FOUND;
505
506                 int hash = Hash(key);
507                 int i = hash & (__capacity - 1);
508
509                 for (__HashMapEntryT< KeyType, ValueType >* pEntry = __pTable[i]; null != pEntry; pEntry = pEntry->pNext)
510                 {
511                         if (hash == pEntry->hash)
512                         {
513                                 int cmpResult;
514                                 r = __pComparer->Compare(key, pEntry->key, cmpResult);
515                                 TryReturn(r == E_SUCCESS, E_INVALID_ARG, "[%s] Propagating.", GetErrorMessage(r));
516
517                                 if (cmpResult == 0)
518                                 {
519                                         value = pEntry->value;
520                                         return E_SUCCESS;
521                                 }
522                         }
523                 }
524
525                 return E_OBJ_NOT_FOUND;
526         }
527
528         /**
529          * Gets the value associated with the specified @c key.
530          *
531          * @since 2.0
532          *
533          * @return              The value associated with the key, @n
534          *                              else @c null if an exception occurs
535          * @param[in]   key                                     The key to locate
536          * @param[out]  value                           The value associated with the @c key
537          * @exception   E_SUCCESS                       The method is successful.
538          * @exception   E_INVALID_ARG           Either of the following conditions has occurred:
539          *                                                                      - A specified input parameter is invalid.
540          *                                                                      - The comparer has failed to compare the keys.
541          * @exception   E_OBJ_NOT_FOUND         The specified @c key has not been found in the map.
542          * @see                 SetValue()
543          */
544         virtual result GetValue(const KeyType& key, ValueType& value)
545         {
546                 return (static_cast< const HashMapT< KeyType, ValueType >* >(this))->GetValue(key, value);
547         }
548
549         /**
550          * Gets the list of all the keys in the map.
551          *
552          * @since 2.0
553          *
554          * @return              A pointer to the IListT object that contains all the keys in the map, @n
555          *                              else @c null if an exception occurs
556          * @exception   E_SUCCESS               The method is successful.
557          * @exception   E_OUT_OF_MEMORY The memory is insufficient.
558          * @remarks
559          *                              - The order of the keys is the same as the corresponding values in the IListT interface returned by the GetValuesN() method.
560          *                              - The specific error code can be accessed using the GetLastResult() method.
561          * @see                 GetValuesN()
562          */
563         virtual IListT< KeyType >* GetKeysN(void) const
564         {
565                 result r = E_SUCCESS;
566
567                 ArrayListT< KeyType >* pList = new ArrayListT< KeyType >();
568                 TryCatch(pList != null, r = E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
569
570                 r = pList->Construct(__count);
571                 TryCatch(r == E_SUCCESS, , "[%s] Propagating.", GetErrorMessage(r));
572
573                 for (int i = 0; i < __capacity; i++)
574                 {
575                         for (__HashMapEntryT< KeyType, ValueType >* pEntry = __pTable[i]; null != pEntry; pEntry = pEntry->pNext)
576                         {
577                                 r = pList->Add(pEntry->key);
578                                 TryCatch(r == E_SUCCESS, , "[%s] Propagating.", GetErrorMessage(r));
579                         }
580                 }
581
582                 SetLastResult(E_SUCCESS);
583                 return pList;
584
585 CATCH:
586                 delete pList;
587
588                 SetLastResult(r);
589                 return null;
590         }
591
592         /**
593          * Gets all the values in the map.
594          *
595          * @since 2.0
596          *
597          * @return              A pointer to the IListT object that contains all the values in the map, @n
598          *                              else @c null if an exception occurs
599          * @exception   E_SUCCESS               The method is successful.
600          * @exception   E_OUT_OF_MEMORY The memory is insufficient.
601          * @remarks             The specific error code can be accessed using the GetLastResult() method.
602          * @see                 GetKeysN()
603          */
604         virtual IListT< ValueType >* GetValuesN(void) const
605         {
606                 result r = E_SUCCESS;
607
608                 ArrayListT< ValueType >* pList = new ArrayListT< ValueType >();
609                 TryCatch(pList != null, r = E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
610
611                 r = pList->Construct(__count);
612                 TryCatch(r == E_SUCCESS, , "[%s] Propagating.", GetErrorMessage(r));
613
614                 for (int i = 0; i < __capacity; i++)
615                 {
616                         for (__HashMapEntryT< KeyType, ValueType >* pEntry = __pTable[i]; null != pEntry; pEntry = pEntry->pNext)
617                         {
618                                 r = pList->Add(pEntry->value);
619                                 TryCatch(r == E_SUCCESS, , "[%s] Propagating.", GetErrorMessage(r));
620                         }
621                 }
622
623                 SetLastResult(E_SUCCESS);
624                 return pList;
625
626 CATCH:
627                 delete pList;
628
629                 SetLastResult(r);
630                 return null;
631         }
632
633         /**
634          * Removes the value associated to the specified @c key.
635          *
636          * @since 2.0
637          *
638          * @return              An error code
639          * @param[in]   key                             The key to remove
640          * @exception   E_SUCCESS                       The method is successful.
641          * @exception   E_INVALID_ARG           Either of the following conditions has occurred:
642          *                                                                      - The specified input parameter is invalid.
643          *                                                                      - The comparer has failed to compare the keys.
644          * @exception   E_OBJ_NOT_FOUND         The specified @c key has not been found in the map.
645          * @see                 Add()
646          */
647         virtual result Remove(const KeyType& key)
648         {
649                 result r = E_OBJ_NOT_FOUND;
650                 int hash = Hash(key);
651                 int i = hash & (__capacity - 1);
652
653                 __HashMapEntryT< KeyType, ValueType >* pPrev = __pTable[i];
654                 for (__HashMapEntryT< KeyType, ValueType >* pEntry = __pTable[i]; null != pEntry; pEntry = pEntry->pNext)
655                 {
656                         if (hash == pEntry->hash)
657                         {
658                                 int cmpResult;
659                                 r = __pComparer->Compare(key, pEntry->key, cmpResult);
660                                 TryReturn(r == E_SUCCESS, E_INVALID_ARG, "[%s] Propagating.", GetErrorMessage(r));
661
662                                 if (cmpResult == 0)
663                                 {
664                                         __modCount++;
665                                         if (pPrev == pEntry)
666                                         {
667                                                 __pTable[i] = pEntry->pNext;
668                                         }
669                                         else
670                                         {
671                                                 pPrev->pNext = pEntry->pNext;
672                                         }
673
674                                         delete pEntry;
675                                         __count--;
676
677                                         return E_SUCCESS;
678                                 }
679                         }
680                         pPrev = pEntry;
681                 }
682
683                 return E_OBJ_NOT_FOUND;
684         }
685
686         /**
687          * Removes all the key-value pairs in the map.
688          *
689          * @since 2.0
690          */
691         virtual void RemoveAll(void)
692         {
693                 if (__count > 0)
694                 {
695                         __modCount++;
696                         Reset();
697                         __count = 0;
698                 }
699         }
700
701         /**
702          * Replaces the value associated with the specified @c key with the specified new @c value.
703          *
704          * @since 2.0
705          *
706          * @return              An error code
707          * @param[in]   key                                     The key whose value is replaced
708          * @param[in]   value                           The new value to replace
709          * @exception   E_SUCCESS                       The method is successful.
710          * @exception   E_INVALID_ARG           Either of the following conditions has occurred:
711          *                                                                      - A specified input parameter is invalid.
712          *                                                                      - The comparer has failed to compare the keys.
713          * @exception   E_OBJ_NOT_FOUND         The specified @c key has not been found in the map.
714          * @remarks             Use the Add() method to add a new key-value pair.
715          * @see                 GetValue()
716          */
717         virtual result SetValue(const KeyType& key, const ValueType& value)
718         {
719                 result r = E_SUCCESS;
720                 int hash = Hash(key);
721                 int i = hash & (__capacity - 1);
722
723                 int cmpResult = -1;
724                 for (__HashMapEntryT< KeyType, ValueType >* pEntry = __pTable[i]; null != pEntry; pEntry = pEntry->pNext)
725                 {
726                         if (hash == pEntry->hash)
727                         {
728                                 r = __pComparer->Compare(key, pEntry->key, cmpResult);
729                                 TryReturn(r == E_SUCCESS, E_INVALID_ARG, "[%s] Propagating.", GetErrorMessage(r));
730                                 if (cmpResult == 0)
731                                 {
732                                         pEntry->value = value;
733                                         break;
734                                 }
735                         }
736                 }
737
738                 if (cmpResult != 0)
739                 {
740                         r = E_OBJ_NOT_FOUND;
741                 }
742
743                 __modCount++;
744
745                 return r;
746         }
747
748         /**
749          * Gets the number of pairs currently stored in the map.
750          *
751          * @since 2.0
752          *
753          * @return              The pairs stored in the map
754          */
755         virtual int GetCount(void) const
756         {
757                 return __count;
758         }
759
760         /**
761          * Checks whether the map contains the specified @c key.
762          *
763          * @since 2.0
764          *
765          * @return              An error code
766          * @param[in]   key                                     The key to locate
767          * @param[out]  out                             Set to @c true if the map contains the specified @c key, @n
768          *                                                                      else @c false
769          * @exception   E_SUCCESS                       The method is successful.
770          * @exception   E_INVALID_ARG           Either of the following conditions has occurred:
771          *                                                                      - A specified input parameter is invalid.
772          *                                                                      - The comparer has failed to compare the keys.
773          * @see                 ContainsValue()
774          */
775         virtual result ContainsKey(const KeyType& key, bool& out) const
776         {
777                 out = false;
778
779                 result r = E_SUCCESS;
780                 int hash = Hash(key);
781                 int i = hash & (__capacity - 1);
782
783                 for (__HashMapEntryT< KeyType, ValueType >* pEntry = __pTable[i]; null != pEntry; pEntry = pEntry->pNext)
784                 {
785                         if (hash == pEntry->hash)
786                         {
787                                 int cmpResult;
788                                 r = __pComparer->Compare(key, pEntry->key, cmpResult);
789                                 TryReturn(r == E_SUCCESS, E_INVALID_ARG, "[%s] Propagating.", GetErrorMessage(r));
790
791                                 if (cmpResult == 0)
792                                 {
793                                         out = true;
794                                         break;
795                                 }
796                         }
797                 }
798
799                 return E_SUCCESS;
800         }
801
802         /**
803          * Checks whether the map contains the specified @c value.
804          *
805          * @since 2.0
806          *
807          * @return              @c true if the map contains the specified @c value, @n
808          *                              else @c false
809          * @param[in]   value   The value to locate
810          *
811          * @see                 ContainsKey()
812          */
813         virtual bool ContainsValue(const ValueType& value) const
814         {
815                 for (int i = 0; i < __capacity; i++)
816                 {
817                         for (__HashMapEntryT< KeyType, ValueType >* pEntry = __pTable[i]; null != pEntry; pEntry = pEntry->pNext)
818                         {
819                                 if (value == pEntry->value)
820                                 {
821                                         return true;
822                                 }
823                         }
824                 }
825
826                 return false;
827         }
828
829         /**
830          * Compares two instances of %HashMapT.
831          *
832          * @since 2.0
833          *
834          * @return              @c true if the two instances match, @n
835          *                              else @c false
836          * @param[in]   obj The object to compare with the current instance
837          * @remarks             This method returns @c true if and only if the two instances contain the same number of elements and all the elements are present in both of them.
838          */
839         virtual bool Equals(const Object& obj) const
840         {
841                 const HashMapT< KeyType, ValueType >* other = dynamic_cast< const HashMapT< KeyType, ValueType >* >(&obj);
842                 if (null == other)
843                 {
844                         return false;
845                 }
846                 else if (other == this)
847                 {
848                         return true;
849                 }
850                 else if (__count != other->__count)
851                 {
852                         return false;
853                 }
854                 else
855                 {
856                         for (int i = 0; i < __capacity; i++)
857                         {
858                                 for (__HashMapEntryT< KeyType, ValueType >* pEntry = __pTable[i]; null != pEntry; pEntry = pEntry->pNext)
859                                 {
860                                         ValueType otherValue;
861                                         result r = other->GetValue(pEntry->key, otherValue);
862                                         if (IsFailed(r))
863                                         {
864                                                 return false;
865                                         }
866                                         if (pEntry->value != otherValue)
867                                         {
868                                                 return false;
869                                         }
870                                 }
871                         }
872                 }
873
874                 return true;
875         }
876
877         /**
878          * Gets the hash value of the current instance.
879          *
880          * @since 2.0
881          *
882          * @return      The hash value of the current instance
883          * @remarks     The two Tizen::Base::Object::Equals() instances must return the same hash value. @n
884          *                              For better performance, the used hash function must generate a random distribution for all the inputs.
885          */
886         virtual int GetHashCode(void) const
887         {
888                 int hash = 0;
889                 for (int i = 0; i < __capacity; i++)
890                 {
891                         for (__HashMapEntryT< KeyType, ValueType >* pEntry = __pTable[i]; null != pEntry; pEntry = pEntry->pNext)
892                         {
893                                 hash += reinterpret_cast< int >(&pEntry->key);
894                                 hash += reinterpret_cast< int >(&pEntry->value);
895                         }
896                 }
897                 return hash;
898         }
899
900 private:
901         /**
902          * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
903          *
904          * @param[in]   map The instance of the %HashMapT class to copy from
905          */
906         HashMapT(const HashMapT< KeyType, ValueType >& map);
907
908         /**
909          * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
910          *
911          * @param[in]   map An instance of %HashMapT
912          */
913         HashMapT< KeyType, ValueType >& operator =(const HashMapT< KeyType, ValueType >& map);
914
915         /**
916          * Copies all the pairs from a specified @c map to this map.
917          *
918          * @return              An error code
919          * @param[in]   map                                     The map to copy
920          * @exception   E_SUCCESS                       The method is successful.
921          * @exception   E_INVALID_OPERATION     The current state of the instance prohibits the execution of the specified operation. @n
922          *                                                                      The @c map is modified during the operation of this method.
923          */
924         result AddAll(const IMapT< KeyType, ValueType >& map)
925         {
926                 result r = E_SUCCESS;
927
928                 IMapT< KeyType, ValueType >* pMap = const_cast< IMapT< KeyType, ValueType >* >(&map);
929                 IMapEnumeratorT< KeyType, ValueType >* pMapEnum = pMap->GetMapEnumeratorN();
930
931                 TryCatch(pMapEnum != null, r = GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
932
933                 while ((r = pMapEnum->MoveNext()) != E_OUT_OF_RANGE)
934                 {
935                         TryCatch(r == E_SUCCESS, , "[%s] Propagating.", GetErrorMessage(r));
936
937                         KeyType key;
938                         ValueType value;
939
940                         r = pMapEnum->GetKey(key);
941                         TryCatch(r == E_SUCCESS, , "[%s] Propagating.", GetErrorMessage(r));
942
943                         r = pMapEnum->GetValue(value);
944                         TryCatch(r == E_SUCCESS, , "[%s] Propagating.", GetErrorMessage(r));
945
946                         int hash = Hash(key);
947                         int i = hash & (__capacity - 1);
948                         __HashMapEntryT< KeyType, ValueType >* pNewEntry = new __HashMapEntryT< KeyType, ValueType >(key, value, __pTable[i], hash);
949
950                         TryCatch(pNewEntry != null, r = E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
951                         __pTable[i] = pNewEntry;
952                         __count++;
953                 }
954
955                 if (null != pMapEnum)
956                 {
957                         delete pMapEnum;
958                 }
959
960                 return E_SUCCESS;
961
962 CATCH:
963                 if (null != pMapEnum)
964                 {
965                         delete pMapEnum;
966                 }
967
968                 return r;
969         }
970
971         /**
972          * Gets the hash value for the specified object.
973          *
974          * @return              The hash value for the specified object
975          * @param[in]   obj             The object to get hash value
976          */
977         int Hash(const KeyType& obj) const
978         {
979                 int h = __pProvider->GetHashCode(obj);
980
981                 h ^= (h >> 20) ^ (h >> 12);
982
983                 return h ^ (h >> 7) ^ (h >> 4);
984         }
985
986         /**
987          * Resizes the content of a map to a new array with a greater capacity.
988          *
989          * @return              An error code
990          * @param[in]   newCapacity             The new capacity @n
991          *                                                              It must be a power of two and greater than the current capacity.
992          * @exception   E_SUCCESS                       The method is successful.
993          * @exception   E_OUT_OF_MEMORY         The memory is insufficient.
994          * @remarks     This method is called automatically when the number of keys in a map reaches its threshold.
995          */
996         result Resize(int newCapacity)
997         {
998                 result r = E_SUCCESS;
999                 __HashMapEntryT< KeyType, ValueType >** pNewTable = new __HashMapEntryT< KeyType, ValueType >*[newCapacity];
1000                 TryReturn(pNewTable != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
1001
1002                 memset(pNewTable, null, sizeof(__HashMapEntryT< KeyType, ValueType >*) * newCapacity);
1003
1004                 for (int i = 0; i < __capacity; i++)
1005                 {
1006                         __HashMapEntryT< KeyType, ValueType >* pEntry = __pTable[i];
1007                         while (null != pEntry)
1008                         {
1009                                 __HashMapEntryT< KeyType, ValueType >* pNext = pEntry->pNext;
1010                                 int i = pEntry->hash & (newCapacity - 1);
1011                                 pEntry->pNext = pNewTable[i];
1012                                 pNewTable[i] = pEntry;
1013                                 pEntry = pNext;
1014                         }
1015                 }
1016
1017                 delete[] __pTable;
1018                 __pTable = pNewTable;
1019                 __capacity = newCapacity;
1020                 __threshold = static_cast< int >(__capacity * __loadFactor);
1021
1022                 return r;
1023         }
1024
1025         /**
1026          * Clears all key-value pairs in this map.
1027          */
1028         void Reset(void)
1029         {
1030                 for (int i = 0; i < __capacity; i++)
1031                 {
1032                         __HashMapEntryT< KeyType, ValueType >* pEntry = __pTable[i];
1033                         while (null != pEntry)
1034                         {
1035                                 __HashMapEntryT< KeyType, ValueType >* pNext = pEntry->pNext;
1036                                 delete pEntry;
1037                                 pEntry = pNext;
1038                         }
1039                         __pTable[i] = null;
1040                 }
1041         }
1042
1043         __HashMapEntryT< KeyType, ValueType >** __pTable;
1044         int __count;
1045         int __capacity;
1046         float __loadFactor;
1047         int __threshold;
1048         IHashCodeProviderT< KeyType >* __pProvider;
1049         IComparerT< KeyType >* __pComparer;
1050         bool __defaultConstruct;
1051         int __modCount;
1052
1053         static const int DEFAULT_CAPACITY = 16;
1054         static const float DEFAULT_LOAD_FACTOR;
1055
1056         friend class __HashMapEnumeratorT< KeyType, ValueType >;
1057
1058 }; // HashMapT
1059
1060 //
1061 // @class       __HashMapEntryT
1062 // @brief       This is an entry for the %HashMapT class.
1063 // @since 2.0
1064 //
1065 template< class KeyType, class ValueType >
1066 class __HashMapEntryT
1067         : public Object
1068 {
1069 public:
1070         /**
1071          * This is the constructor for this class.
1072          *
1073          * @since 2.0
1074          *
1075          * @param[in]   k               The key to include in this entry
1076          * @param[in]   v               The value to include in this entry
1077          * @param[in]   next    A pointer to the next entry
1078          * @param[in]   h               The hash value of the key
1079          */
1080         __HashMapEntryT(const KeyType& k, const ValueType& v, __HashMapEntryT< KeyType, ValueType >* next, int h)
1081                 : key(k)
1082                 , value(v)
1083                 , hash(h)
1084                 , pNext(next)
1085         {
1086         }
1087
1088         /**
1089          * This is the destructor for this class.
1090          *
1091          * @since 2.0
1092          */
1093         virtual ~__HashMapEntryT(void)
1094         {
1095         }
1096
1097         /**
1098          * Internal variable.
1099          *
1100          * @since 2.0
1101          */
1102         KeyType key;
1103
1104         /**
1105          * Internal variable.
1106          *
1107          * @since 2.0
1108          */
1109         ValueType value;
1110
1111         /**
1112          * Internal variable.
1113          *
1114          * @since 2.0
1115          */
1116         int hash;
1117
1118         /**
1119          * Internal variable.
1120          *
1121          * @since 2.0
1122          */
1123         __HashMapEntryT< KeyType, ValueType >* pNext;
1124
1125 }; // __HashMapEntryT
1126
1127 //
1128 // @class       __HashMapEnumeratorT
1129 // @brief       This is an implementation of the IMapEnumeratorT interface for the %HashMapT class.
1130 // @since 2.0
1131 //
1132 template< class KeyType, class ValueType >
1133 class __HashMapEnumeratorT
1134         : public IMapEnumeratorT< KeyType, ValueType >
1135         , public Object
1136 {
1137 public:
1138         /**
1139          * This is the constructor for this class.
1140          *
1141          * @since 2.0
1142          *
1143          * @param[in]   map                     The map to enumerate
1144          * @param[in]   modCount        The modification count to detect the change in the map
1145          */
1146         __HashMapEnumeratorT(const HashMapT< KeyType, ValueType >& map, int modCount)
1147                 : __map(map)
1148                 , __modCount(modCount)
1149                 , __pEntry(null)
1150                 , __index(-1)
1151         {
1152
1153         }
1154
1155         /**
1156          * This is the destructor for this class.
1157          *
1158          * @since 2.0
1159          */
1160         virtual ~__HashMapEnumeratorT(void)
1161         {
1162
1163         }
1164
1165         /**
1166          * Gets the current object in the map.
1167          *
1168          * @since 2.0
1169          *
1170          * @return              An error code
1171          * @param[out]  obj                                     The current object
1172          * @exception   E_SUCCESS                       The method is successful.
1173          * @exception   E_INVALID_OPERATION     Either of the following conditions has occurred:
1174          *                                                                      - The current state of the instance prohibits the execution of the specified operation.
1175          *                                                                      - This enumerator is currently positioned before the first element or past the last element.
1176          *                                                                      - The map is modified after this enumerator is created.
1177          */
1178         virtual result GetCurrent(MapEntryT< KeyType, ValueType >& obj) const
1179         {
1180                 TryReturn((__modCount == __map.__modCount), E_INVALID_OPERATION,
1181                         "[%s] The source collection is modified after the creation of this enumerator.", GetErrorMessage(E_INVALID_OPERATION));
1182                 TryReturn((__pEntry != null), E_INVALID_OPERATION, "[%s] Invalid position(pEntry is null).", GetErrorMessage(E_INVALID_OPERATION));
1183
1184                 obj = MapEntryT< KeyType, ValueType >(__pEntry->key, __pEntry->value);
1185                 return E_SUCCESS;
1186         }
1187
1188         /**
1189          * Moves this enumerator to the next element of the map.
1190          * When this enumerator is first created, or when the Reset() method is called, or when the %MoveNext() method is first called, the enumerator positions itself to the first element in the map.
1191          *
1192          * @since 2.0
1193          *
1194          * @return              An error code
1195          * @exception   E_SUCCESS                       The method is successful.
1196          * @exception   E_INVALID_OPERATION     Either of the following conditions has occurred:
1197          *                                                                      - The current state of the instance prohibits the execution of the specified operation.
1198          *                                                                      - The map is modified after this enumerator is created.
1199          * @exception   E_OUT_OF_RANGE          The enumerator has passed the end of the map.
1200          */
1201         virtual result MoveNext(void)
1202         {
1203                 TryReturn((__modCount == __map.__modCount), E_INVALID_OPERATION,
1204                         "[%s] The source collection is modified after the creation of this enumerator.", GetErrorMessage(E_INVALID_OPERATION));
1205
1206                 if ((null != __pEntry) && (null != __pEntry->pNext))
1207                 {
1208                         __pEntry = __pEntry->pNext;
1209                         return E_SUCCESS;
1210                 }
1211                 else
1212                 {
1213                         while (++__index < __map.__capacity)
1214                         {
1215                                 __pEntry = __map.__pTable[__index];
1216                                 if (null != __pEntry)
1217                                 {
1218                                         return E_SUCCESS;
1219                                 }
1220                         }
1221                 }
1222
1223                 return E_OUT_OF_RANGE;
1224         }
1225
1226         /**
1227          * Positions the enumerator before the first element in the map.
1228          *
1229          * @since 2.0
1230          *
1231          * @return              An error code
1232          * @exception   E_SUCCESS                       The method is successful.
1233          * @exception   E_INVALID_OPERATION     Either of the following conditions has occurred:
1234          *                                                                      - The current state of the instance prohibits the execution of the specified operation.
1235          *                                                                      - The map is modified after this enumerator is created.
1236          */
1237         virtual result Reset(void)
1238         {
1239                 TryReturn((__modCount == __map.__modCount), E_INVALID_OPERATION,
1240                         "[%s] The source collection is modified after the creation of this enumerator.", GetErrorMessage(E_INVALID_OPERATION));
1241
1242                 __index = -1;
1243                 __pEntry = null;
1244                 return E_SUCCESS;
1245         }
1246
1247         /**
1248          * Gets the current key in the map.
1249          *
1250          * @since 2.0
1251          *
1252          * @return              An error code
1253          * @param[out]  key                                     The current key
1254          * @exception   E_SUCCESS                       The method is successful.
1255          * @exception   E_INVALID_OPERATION     Either of the following conditions has occurred:
1256          *                                                                      - The current state of the instance prohibits the execution of the specified operation.
1257          *                                                                      - This enumerator is currently positioned before the first element or past the last element.
1258          *                                                                      - The map is modified after this enumerator is created.
1259          */
1260         virtual result GetKey(KeyType& key) const
1261         {
1262                 TryReturn((__modCount == __map.__modCount), E_INVALID_OPERATION,
1263                         "[%s] The source collection is modified after the creation of this enumerator.", GetErrorMessage(E_INVALID_OPERATION));
1264                 TryReturn((__pEntry != null), E_INVALID_OPERATION, "[%s] Invalid position(pEntry is null).", GetErrorMessage(E_INVALID_OPERATION));
1265
1266                 key = __pEntry->key;
1267                 return E_SUCCESS;
1268         }
1269
1270         /**
1271          * Gets the current value in the map.
1272          *
1273          * @since 2.0
1274          *
1275          * @return              An error code
1276          * @param[out]  value                           The current value
1277          * @exception   E_SUCCESS                       The method is successful.
1278          * @exception   E_INVALID_OPERATION     Either of the following conditions has occurred:
1279          *                                                                      - The current state of the instance prohibits the execution of the specified operation.
1280          *                                                                      - This enumerator is currently positioned before the first element or past the last element 
1281          *                                                                      - The map is modified after the enumerator is created.
1282          */
1283         virtual result GetValue(ValueType& value) const
1284         {
1285                 TryReturn((__modCount == __map.__modCount), E_INVALID_OPERATION,
1286                         "[%s] The source collection is modified after the creation of this enumerator.", GetErrorMessage(E_INVALID_OPERATION));
1287                 TryReturn((__pEntry != null), E_INVALID_OPERATION, "[%s] Invalid position(pEntry is null).", GetErrorMessage(E_INVALID_OPERATION));
1288
1289                 value = __pEntry->value;
1290                 return E_SUCCESS;
1291         }
1292
1293 private:
1294         const HashMapT< KeyType, ValueType >& __map;
1295         int __modCount;
1296         __HashMapEntryT< KeyType, ValueType >* __pEntry;
1297         int __index;
1298
1299 }; // __HashMapEnumeratorT
1300
1301 //
1302 // @class       __HashMapDefaultProviderT
1303 // @brief       This is an implementation of the IHashCodeProviderT interface for the HashMap class.
1304 // @since 2.0
1305 //
1306 template< class KeyType >
1307 class __HashMapDefaultProviderT
1308         : public IHashCodeProviderT< KeyType >
1309         , public Object
1310 {
1311 public:
1312         /**
1313         * This is the default constructor for this class.
1314         *
1315         * @since 2.0
1316         */
1317         __HashMapDefaultProviderT(void) {}
1318
1319         /**
1320         * This is the destructor for this class.
1321         *
1322         * @since 2.0
1323         */
1324         virtual ~__HashMapDefaultProviderT(void) {}
1325
1326         /**
1327         * Gets the hash code of the specified object.
1328         *
1329         * @since 2.0
1330         *
1331         * @return               The hash code of the specified object
1332         * @see                  Tizen::Base::Object::GetHashCode
1333         */
1334         virtual int GetHashCode(const KeyType& obj) const
1335         {
1336                 return (int) obj;
1337         }
1338
1339 }; // __HashMapDefaultProviderT
1340
1341 template< class KeyType, class ValueType >
1342 const float HashMapT< KeyType, ValueType >::DEFAULT_LOAD_FACTOR = 0.75;
1343
1344 }}} // Tizen::Base::Collection
1345
1346 #endif //_FBASE_COL_HASH_MAP_T_H_