KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > gnu > trove > THashMapTest


1 ///////////////////////////////////////////////////////////////////////////////
2
// Copyright (c) 2001-2006, Eric D. Friedman All Rights Reserved.
3
//
4
// This library is free software; you can redistribute it and/or
5
// modify it under the terms of the GNU Lesser General Public
6
// License as published by the Free Software Foundation; either
7
// version 2.1 of the License, or (at your option) any later version.
8
//
9
// This library is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU Lesser General Public
15
// License along with this program; if not, write to the Free Software
16
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
///////////////////////////////////////////////////////////////////////////////
18

19 package gnu.trove;
20
21 import junit.framework.TestCase;
22
23 import java.io.ByteArrayInputStream JavaDoc;
24 import java.io.ByteArrayOutputStream JavaDoc;
25 import java.io.ObjectInputStream JavaDoc;
26 import java.io.ObjectOutputStream JavaDoc;
27 import java.util.*;
28
29 /**
30  *
31  * Created: Sat Nov 3 10:31:38 2001
32  *
33  * @author Eric D. Friedman
34  * @version $Id: THashMapTest.java,v 1.7 2006/12/04 19:23:56 robeden Exp $
35  */

36
37 public class THashMapTest extends TestCase {
38
39     protected THashMap map;
40     protected int count;
41     
42     public THashMapTest(String JavaDoc name) {
43         super(name);
44     }
45
46     public void setUp() throws Exception JavaDoc {
47         super.setUp();
48         map = new THashMap();
49         count = 0;
50     }
51
52     public void tearDown() throws Exception JavaDoc {
53         super.tearDown();
54         map = null;
55         count = 0;
56     }
57
58     public void testPut() throws Exception JavaDoc {
59         assertEquals("put succeeded",null, map.put("One","two"));
60         assertEquals("size did not reflect put", 1, map.size());
61         assertEquals("put/get failed", "two", map.get("One"));
62         assertEquals("second put failed","two",map.put("One","foo"));
63     }
64
65     public void testClear() throws Exception JavaDoc {
66         assertEquals("initial size was not zero", 0, map.size());
67         assertEquals("put succeeded",null, map.put("One","two"));
68         assertEquals("size did not reflect put", 1, map.size());
69         map.clear();
70         assertEquals("cleared size was not zero", 0, map.size());
71     }
72
73     public void testContainsKey() throws Exception JavaDoc {
74         Object JavaDoc key = "hi";
75         assertTrue("should not contain key initially", ! map.containsKey(key));
76         assertEquals("put succeeded",null, map.put(key, new Integer JavaDoc(1)));
77         assertTrue("key not found after put", map.containsKey(key));
78     }
79
80     public void testGet() throws Exception JavaDoc {
81         Object JavaDoc key = "hi", val = "one", val2 = "two";
82
83         map.put(key,val);
84         assertEquals("get did not return expected value",val, map.get(key));
85         map.put(key,val2);
86         assertEquals("get did not return expected value on second put",
87                      val2, map.get(key));
88     }
89
90     public void testValues() throws Exception JavaDoc {
91         Object JavaDoc k1 = "1", k2 = "2", k3 = "3", k4 = "4", k5 = "5";
92         Object JavaDoc v1 = "x", v2 = "y", v3 = "z";
93
94         map.put(k1,v1);
95         map.put(k2,v1);
96         map.put(k3,v2);
97         map.put(k4,v3);
98         map.put(k5,v2);
99         Collection vals = map.values();
100         assertEquals("size was not 5", 5, vals.size());
101         vals.remove("z");
102         assertEquals("size was not 4", 4, vals.size());
103         vals.remove("y");
104         assertEquals("size was not 3", 3, vals.size());
105         vals.remove("y");
106         assertEquals("size was not 2", 2, vals.size());
107         assertEquals("map did not diminish to 2 entries", 2, map.size());
108     }
109
110     public void testKeySet() throws Exception JavaDoc {
111         Object JavaDoc key1 = "hi", key2 = "bye", key3 = "whatever";
112         Object JavaDoc val = "x";
113
114         map.put(key1, val);
115         map.put(key2, val);
116         map.put(key3, val);
117
118         Set keys = map.keySet();
119         assertTrue("keyset did not match expected set",
120                    keys.containsAll(Arrays.asList(new Object JavaDoc[] { key1, key2, key3 })));
121         assertEquals(3, map.size());
122
123         int count = 0;
124         Iterator it = keys.iterator();
125         while( it.hasNext() ) {
126             count++;
127             it.next();
128         }
129         assertEquals(map.size(),count);
130
131         for (Iterator i = keys.iterator(); i.hasNext();) {
132             Object JavaDoc o = i.next();
133             if (o.equals(key2)) {
134                 i.remove();
135             }
136         }
137         assertTrue("keyset did not match expected set",
138                    keys.containsAll(Arrays.asList(new Object JavaDoc[] { key1, key3 })));
139     }
140
141     public void testForEachEntry() throws Exception JavaDoc {
142         Object JavaDoc[] keys = { "one","two","three","four" };
143         Object JavaDoc[] vals = { new Integer JavaDoc(1),
144                           new Integer JavaDoc(2),
145                           new Integer JavaDoc(3),
146                           new Integer JavaDoc(4)
147         };
148         for (int i = 0; i < keys.length; i++) {
149             map.put(keys[i],vals[i]);
150         }
151
152         TObjectObjectProcedure proc = new TObjectObjectProcedure() {
153                 public boolean execute(Object JavaDoc key, Object JavaDoc value) {
154                     count += ((Integer JavaDoc)value).intValue();
155                     return true;
156                 }
157             };
158         map.forEachEntry(proc);
159         assertEquals(10,count);
160     }
161
162     public void testForEachEntryInterrupt() throws Exception JavaDoc {
163         Object JavaDoc[] keys = { "one","two","three","four" };
164         Object JavaDoc[] vals = { new Integer JavaDoc(1),
165                           new Integer JavaDoc(2),
166                           new Integer JavaDoc(3),
167                           new Integer JavaDoc(4)
168         };
169         for (int i = 0; i < keys.length; i++) {
170             map.put(keys[i],vals[i]);
171         }
172
173         TObjectObjectProcedure proc = new TObjectObjectProcedure() {
174                 public boolean execute(Object JavaDoc key, Object JavaDoc value) {
175                     count += ((Integer JavaDoc)value).intValue();
176                     return count >= 6 ? false: true;
177                 }
178             };
179         map.forEachEntry(proc);
180         assertTrue(count < 10);
181     }
182
183     public void testTransformValues() throws Exception JavaDoc {
184         Object JavaDoc[] keys = { "one","two","three","four" };
185         Object JavaDoc[] vals = { new Integer JavaDoc(1),
186                           new Integer JavaDoc(2),
187                           new Integer JavaDoc(3),
188                           new Integer JavaDoc(4)
189         };
190         for (int i = 0; i < keys.length; i++) {
191             map.put(keys[i],vals[i]);
192         }
193
194         TObjectFunction func = new TObjectFunction() {
195                 public Object JavaDoc execute(Object JavaDoc value) {
196                     int num = ((Integer JavaDoc)value).intValue();
197                     return new Integer JavaDoc(num << 1);
198                 }
199             };
200         map.transformValues(func);
201         assertEquals(new Integer JavaDoc(2),map.get("one"));
202         assertEquals(new Integer JavaDoc(4),map.get("two"));
203         assertEquals(new Integer JavaDoc(6),map.get("three"));
204         assertEquals(new Integer JavaDoc(8),map.get("four"));
205     }
206
207     public void testKeyIterator() throws Exception JavaDoc {
208         Object JavaDoc[] keys = { "one","two","three","four" };
209         Object JavaDoc[] vals = { new Integer JavaDoc(1),
210                           new Integer JavaDoc(2),
211                           new Integer JavaDoc(3),
212                           new Integer JavaDoc(4)
213         };
214         for (int i = 0; i < keys.length; i++) {
215             map.put(keys[i],vals[i]);
216         }
217
218         int count = 0;
219         for (Iterator i = map.keySet().iterator(); i.hasNext();) {
220             i.next();
221             count++;
222         }
223         assertEquals(4,count);
224     }
225
226
227     public void testCompact() throws Exception JavaDoc {
228         Integer JavaDoc[] data = new Integer JavaDoc[1000];
229         
230         for (int i = 0; i < 1000; i++) {
231             data[i] = new Integer JavaDoc(i);
232             map.put(data[i], data[i]);
233         }
234         assertTrue(map._maxSize > 1000);
235         for (int i = 0; i < 1000; i+=2) {
236 // try {
237
map.remove(data[i]);
238 // }
239
// catch( RuntimeException ex ) {
240
// System.err.println("Error on i: " + i);
241
// System.out.println("Hash codes:");
242
// for( int j = 0 ; j < data.length; j++ ) {
243
// if ( ( j % 8 ) == 0 ) {
244
// System.out.println(",");
245
// }
246
// else System.out.print(",");
247
// System.out.print(map._hashingStrategy.computeHashCode(data[j]));
248
// }
249
//
250
//
251
// System.out.println("Remove:");
252
// for( int j = 0 ; j <= i; j+=2 ) {
253
// if ( ( j % 8 ) == 0 ) {
254
// System.out.println(",");
255
// }
256
// else System.out.print(",");
257
// System.out.print(map._hashingStrategy.computeHashCode(data[j]));
258
// }
259
// throw ex;
260
// }
261
}
262         assertEquals(500, map.size());
263         map.compact();
264         assertEquals(500, map.size());
265         assertTrue(map._maxSize < 1000);
266     }
267
268     public void testContainsNullValue() throws Exception JavaDoc {
269         THashMap mm = new THashMap();
270         mm.put("a",null);
271         assertTrue(mm.containsValue(null));
272     }
273
274     public void testEntrySetContainsEntryWithNullValue() throws Exception JavaDoc {
275         THashMap mm = new THashMap();
276         mm.put("0", null);
277         Map.Entry ee = (Map.Entry)mm.entrySet().iterator().next();
278         assertTrue(mm.entrySet().contains(ee));
279     }
280
281     public void testValueSetRemoveNullValue() throws Exception JavaDoc {
282         THashMap mm = new THashMap();
283         mm.put("0", null);
284         assertTrue(mm.values().remove(null));
285     }
286
287     public void testSizeAfterEntrySetRemove() throws Exception JavaDoc {
288         THashMap mm = new THashMap();
289         mm.put("0", null);
290         Map.Entry ee = (Map.Entry)mm.entrySet().iterator().next();
291         assertTrue(ee.getKey().equals("0"));
292         assertNull(ee.getValue());
293         assertTrue("remove on entrySet() returned false",
294                    mm.entrySet().remove(ee));
295         assertEquals(0, mm.size());
296     }
297
298     public void testEntrySetRemoveSameKeyDifferentValues() throws Exception JavaDoc {
299         THashMap mm1 = new THashMap();
300         mm1.put("0","abc");
301         THashMap mm2 = new THashMap();
302         mm2.put("0","123");
303         Map.Entry ee = (Map.Entry)mm1.entrySet().iterator().next();
304         assertEquals(1, mm2.size());
305         assertTrue(! mm2.entrySet().contains(ee));
306         assertTrue(! mm2.entrySet().remove(ee));
307     }
308
309     public void testSizeAfterMultipleReplacingPuts() throws Exception JavaDoc {
310         THashMap mm = new THashMap();
311         mm.put("key", "a");
312         assertEquals(1, mm.size());
313         mm.put("key", "b");
314         assertEquals(1, mm.size());
315     }
316
317     public void testSerializable() throws Exception JavaDoc {
318         THashMap mm = new THashMap();
319         mm.put("a","b");
320         mm.put("b","c");
321
322         ByteArrayOutputStream JavaDoc baos = new ByteArrayOutputStream JavaDoc();
323         ObjectOutputStream JavaDoc oos = new ObjectOutputStream JavaDoc(baos);
324         oos.writeObject(mm);
325
326         ByteArrayInputStream JavaDoc bais = new ByteArrayInputStream JavaDoc(baos.toByteArray());
327         ObjectInputStream JavaDoc ois = new ObjectInputStream JavaDoc(bais);
328
329         THashMap mm2 = (THashMap)ois.readObject();
330
331         assertEquals(mm, mm2);
332     }
333
334     public void testSerializablePrimitives() throws Exception JavaDoc {
335         TIntIntHashMap mm = new TIntIntHashMap();
336         mm.put(1, -1);
337         mm.put(0, 0);
338     mm.put(127, 68888);
339
340         ByteArrayOutputStream JavaDoc baos = new ByteArrayOutputStream JavaDoc();
341         ObjectOutputStream JavaDoc oos = new ObjectOutputStream JavaDoc(baos);
342         oos.writeObject(mm);
343
344         ByteArrayInputStream JavaDoc bais = new ByteArrayInputStream JavaDoc(baos.toByteArray());
345         ObjectInputStream JavaDoc ois = new ObjectInputStream JavaDoc(bais);
346
347         TIntIntHashMap mm2 = (TIntIntHashMap)ois.readObject();
348
349         assertEquals(mm, mm2);
350     }
351
352     public void testRetainEntries() throws Exception JavaDoc {
353         THashMap mm = new THashMap();
354         mm.put("a", "b");
355         mm.put("c", "b");
356         mm.put("d", "b");
357
358         mm.retainEntries(new TObjectObjectProcedure() {
359                 public boolean execute(Object JavaDoc key, Object JavaDoc val) {
360                     return key.equals("c");
361                 }
362             });
363
364         assertEquals(1, mm.size());
365         assertTrue(mm.containsKey("c"));
366         assertEquals("b", mm.get("c"));
367     }
368
369     public void testPutAll() throws Exception JavaDoc {
370         THashMap t = new THashMap();
371         HashMap m = new HashMap();
372         m.put("one","two");
373         m.put("two","four");
374         m.put("three","six");
375         t.putAll(m);
376     }
377
378     public void testClone() throws Exception JavaDoc {
379         TObjectIntHashMap<String JavaDoc> original = new TObjectIntHashMap<String JavaDoc>();
380         original.put( "one", 1 );
381         original.put( "two", 2 );
382         original.put( "three", 3 );
383
384         TObjectIntHashMap<String JavaDoc> clone = original.clone();
385
386         assertEquals(original,clone);
387         assertEquals(3, clone.size());
388         assertEquals(1, clone.get("one" ));
389         assertEquals(2, clone.get("two" ));
390         assertEquals(3, clone.get("three" ));
391
392         original.clear();
393
394         assertEquals(3, clone.size());
395         assertEquals(1, clone.get("one" ));
396         assertEquals(2, clone.get("two" ));
397         assertEquals(3, clone.get("three" ));
398     }
399
400     public void testHashCode() throws Exception JavaDoc {
401         THashMap m1 = new THashMap();
402         THashMap m2 = new THashMap();
403         m1.put(new String JavaDoc("foo"), new String JavaDoc("bar"));
404         m2.put(new String JavaDoc("foo"), new String JavaDoc("bar"));
405         assertEquals(m1.hashCode(), m2.hashCode());
406         assertEquals(m1, m2);
407         m2.put(new String JavaDoc("cruft"), new String JavaDoc("bar"));
408         assertTrue(m1.hashCode() != m2.hashCode());
409         assertTrue(! m1.equals(m2));
410     }
411
412     public void testBadlyWrittenKey() {
413         boolean didThrow = false;
414         try {
415             for (int i = 0; i < 1000; i++) { // enough to trigger a rehash
416
map.put(new THashSetTest.Crap(), new Integer JavaDoc(i));
417             }
418         } catch (IllegalArgumentException JavaDoc e) {
419             didThrow = true;
420         }
421         assertTrue("expected THashMap to throw an IllegalArgumentException", didThrow);
422     }
423
424     public void testKeySetEqualsEquivalentSet() {
425     Set set = new java.util.HashSet JavaDoc();
426     set.add("foo");
427     set.add("doh");
428     set.add("hal");
429
430     THashMap tv1 = new THashMap();
431     tv1.put("doh", "blah");
432     tv1.put("foo", "blah");
433     tv1.put("hal", "notblah");
434         assertTrue(tv1.keySet().equals(set));
435     }
436
437     public void testNullValue() {
438     THashMap t = new THashMap();
439     t.put("foo", null);
440     t.put("bar", null);
441     t.put("baz", null);
442
443     assertEquals(Arrays.asList(new Object JavaDoc[] { null, null, null }), new ArrayList(t.values()));
444     }
445
446     public void testNullValueSize() {
447         THashMap map = new THashMap();
448                  
449         map.put("narf",null);
450         map.put("narf",null);
451         assertEquals(1, map.size());
452    }
453
454     public void testNullKey() {
455     THashMap t = new THashMap();
456     t.put(null, null);
457     assertEquals(null, t.keySet().iterator().next());
458     }
459
460     public void testRetainEntrySet() {
461         Map orig = new THashMap();
462         orig.put("one", "frodo");
463         orig.put("two", "bilbo");
464         orig.put("three", "samwise");
465
466         Map subset = new HashMap();
467         subset.put("two", "bilbo");
468
469         assertTrue(orig.entrySet().retainAll(subset.entrySet()));
470
471         assertEquals(subset, orig);
472     }
473
474     public void testMapEntrySetHashCode() {
475         Map m1 = new THashMap();
476         m1.put("one", "foo");
477         Map m2 = new THashMap();
478         m2.put("one", "foo");
479
480         Object JavaDoc o1 = m1.entrySet().iterator().next();
481         Object JavaDoc o2 = m1.entrySet().iterator().next();
482         assertTrue(o1 != o2);
483         assertTrue(o1.equals(o2));
484         assertEquals(o1.hashCode(), o2.hashCode());
485     }
486
487     public void testEqualsAndHashCode() {
488         THashMap<String JavaDoc,String JavaDoc> map1 = new THashMap<String JavaDoc,String JavaDoc>();
489         map1.put( "Key1", null );
490
491         THashMap<String JavaDoc,String JavaDoc> map2 = new THashMap<String JavaDoc,String JavaDoc>();
492         map2.put( "Key2", "Value2" );
493
494         assertFalse( "map1.equals( map2 )", map1.equals( map2 ) );
495         assertFalse( "map2.equals( map1 )", map2.equals( map1 ) );
496
497         THashMap<String JavaDoc,String JavaDoc> clone_map1 = map1.clone();
498         THashMap<String JavaDoc,String JavaDoc> clone_map2 = map2.clone();
499
500         assertEquals(map1, clone_map1);
501         assertEquals(map1.hashCode(), clone_map1.hashCode());
502         assertEquals(map2, clone_map2);
503         assertEquals(map2.hashCode(), clone_map2.hashCode());
504     }
505
506
507     /**
508      * Test case for bug #1428614.
509      * http://sourceforge.net/tracker/index.php?func=detail&aid=1428614&group_id=39235&atid=424682
510      */

511     public void testRemoveValue() {
512         THashMap<String JavaDoc,String JavaDoc> map = new THashMap<String JavaDoc,String JavaDoc>();
513         map.put( "one", "a" );
514         map.put( "two", "a" );
515         map.put( "three", "b" );
516
517         assertEquals( 3, map.size() );
518
519         map.values().remove( "a" );
520
521         assertEquals( 2, map.size() );
522     }
523
524
525     /**
526      * This test case arose out of a problem that was ultimately caused by the
527      * implementation if THashMap.removeAt(int) being incorrect (the super implementation
528      * was being called before the local implementation which caused problems when
529      * auto-compaction occurred). So, it's a little wiggy, but since the case was useful
530      * once, I figure I'll leave it in. - RDE
531      */

532     public void testProblematicRemove() {
533         int[] to_add = new int[] {
534             9707851,1432929,7941420,8698105,9178562,14368620,2165498,5759024,
535             4160722,1835074,5570057,15866937,1774305,7645103,11340758,14962053,
536             10326974,5153366,8644308,10981652,2484113,8790215,13765491,15579334,
537             16644662,3538325,10183070,2491991,6963721,1406388,14845099,7614579,
538             1630785,11417789,988981,12372702,11197485,6115155,185310,10733210,
539             4444363,4256211,12877269,2178642,8551718,15095256,922983,10434400,
540             15511986,8792944,9301853,6147907,13778707,2822511,8760514,1112301,
541             4624291,8406178,1708017,834479,16113199,13501060,477791,10737091,
542             2568325,14839924,4523777,13566852,15722007,15406704,932352,127549,
543             13010531,10540591,5100961,288048,9396085,12844726,8887992,12932686,
544             10827776,16751176,15337379,10192984,1341540,15470105,9555179,2394843,
545             1595902,12345969,14884594,313940,8348091,15293845,16706146,13500767,
546             12331344,3959435,7796580,7077998,9458485,4648605,14396291,14246507,
547             13404097,14988605,3600161,9280290,12842832,10606027,14355582,1136752,
548             12921165,1749219,5457859,9197696,421256,73503,10633537,6952660,
549             58264,6164651,9993341,1386282,12470635,12982240,4816459,159250,
550             8949093,16447937,2290043,1828537,13148199,9084516,10802630,13549340,
551             6609445,2995162,8040282,9333002,9580969,16406600,12194236,14835440,
552             13041360,8604473,12565810,1988729,4355359,1535580,5149176,5324752,
553             3438993,1660570,8691895,5474195,15334260,8105437,13879037,11351030,
554             3039475,14625682,10849417,11379670,14640675,11176427,4513965,16428465,
555             10578701,8072595,15538803,6526027,10283251,8507206,5188636,14223982,
556             3920972,15659969,12922874,13689914,3658005,8379437,5247277,9938991,
557             10659712,10678905,14485926,10786998,2488171,9881794,5651833,14538812,
558             10444169,11922157,5403811,6785775,13794224,11958753,16494451,12313218,
559             1297763,1126021,345418,528188,2114627,6400133,8307281,490653,
560             8793363,16336633,10653219,2214875,13551003,1001246,397033,12381376,
561             5991449,1443593,2622811,7847125,944151,13889218,14686341,6939782,
562             1712728,12902341,4138467,13656813,973555,4767079,9100632,13222220,
563             11641873,9082629,12639233,11258141,2146301,1867442,12719413,16679909,
564             8734589,1606713,9501535,6761395,6693929,13647363,9914313,15335895,
565             2021653,4068909,2228794,12603329,11807792,12665538,395494,3299447,
566             5119086,2917420,10055436,4831656,3927888,14447609,4329094,13077467,
567             11461522,14594477,6481991,8367571,7156844,9223013,6482120,10542896,
568             10286402,11125093,14144872,16495825,1844776,860068,9980169,14877755,
569             2804551,8894974,12849678,8215338,15490728,3843485,5184218,7071904,
570             7703600,4633458,11481528,15295069,3736219,14297843,3787634,6015173,
571             14290065,7290758,11764335,3688927,7991532,12075598,606202,4674522,
572             13772937,6515326,14974617,3385263,4587760,15178512,7689244,15015527,
573             3087738,3683764,5107535,10120404,6225460,8588999,4151219,9885848,
574             6691152,518908,13918089,13393004,13093729,16338349,5945377,15632500,
575             4230314,13832167,12139768,5361165,11457892,3916190,2387780,325816,
576             6621694,7540927,5271271,10565439,3281837,11138623,6663214,737100,
577             6864802,16592415,14615312,4342441,2525512,16706191,14258395,11878990,
578             1320531,14696398,8201398,16077183,12155328,15225360,6533378,16390602,
579             11750387,4144864,3744598,4136761,1775074,3787875,10061327,3165792,
580             6921717,84292,7420530,11805441,6704350,4234280,13377633,6417611,
581             81563,11879309,6692731,10285066,5452490,2848306,6094584,6772150,
582             2899899,805004,7273360,4566720,13878010,10871921,3724097,11896809,
583             15586671,5744620,13731591,16250661,8560290,8169917,7059338,14615241,
584             3149669,4383295,1292178,7919990,846550,896930,8769114,11437924,
585             3854132,16345157,2929809,186157,8183120,10860321,10092509,7157818,
586             8817522,2944051,4664124,6791689,12517547,12905829,12435281,5992485,
587             2074096,13062653,14148480,10024647,7455154,6534752,5933059,9930860,
588             8221561,2639915,10098755,11468155,8638604,15770467,7790866,11694410,
589             2868248,5710862,15709,12374346,5274287,10913198,9607083,2330533,
590             11262155,2500209,10878393,11834918,15572289,15669880,11713730,8818293,
591             15907500,12427744,13540318,5978200,13640927,2411696,16408949,1331989,
592             5941655,3414928,16619879,6441500,15706705,9881210,12620326,12259629,
593             6605901,10543825,9125515,12001189,8309409,2696396,3070853,5120614,
594             11830622,10490623,4149060,7141756,7297762,12039919,4930206,16095035,
595             10203610,12162006,10028034,14040149,1250372,9943013,11150309,1752285,
596             6641241,532227,2891993,2146459,4523080,1843838,1876388,12071882,
597             5253689,266407,14770216,7346541,9785383,12662763,4087061,5312086,
598             8667965,5935475,214509,14935237,12603345,12069351,13056011,3177187,
599             13886924,9688141,5714168,5238287,9839924,6586077,12908278,3257673,
600             7665358,16208962,12373914,14796394,11098653,5975276,14839805,2522300,
601             13055068,4113411,11984808,1418893,6924381,11314606,11633137,13235995,
602             8277143,14057346,5064134,2097065,13223254,12242045,13059400,9799866,
603             4430809,11327935,769464,13938921,11178479,5438437,1550013,12839250,
604             727385,11354068,3772220,15394227,9336140,11988768,860366,14994301,
605             15440057,7845075,46465,9200550,14833083,6980643,604527,10080643,
606             9045195,4244693,3844932,12717539,1960282,12786813,8615113,6833198,
607             5522541,5791657,15755268,3994917,158446,12203633,5002730,10253904,
608             1809471,11479213,9928035,11072909,9512807,11660261,16127120,12596061,
609             7086362,15820414,8387982,14653636,10912742,1941253,11740079,15457795,
610             3976572,10595620,7217556,6197451,7618490,258825,4780842,5534349,
611             2921202,6513404,16229803,10332843,3138363,15681804,10802604,13113540,
612             13757900,5443555,3681765,5063855,14185653,14039650,9644178,5024611,
613             8918836,11231866,13523137,2425209,8636320,10944802,3891863,12961644,
614             10984042,9100512,11218774,11581954,8646320,11234763,11887145,4171898,
615             5109569,10742219,4859349,16381539,10419813,5223261,8955000,15061357,
616             1607571,7136846,8670269,11099382,1451676,4261185,12586581,15531576,
617             2504976,7105767,6413040,7144290,16334106,1741877,16270583,7852246,
618             3119103,10743199,4558377,7878745,12289371,3163084,11735282,1935864,
619             5055074,820851,5185654,14442671,5212885,2344949,1892708,1153520,
620             9541794,12306031,14732248,6743381,5920025,8969603,8847687,6622806,
621             9462942,12451035,2336870,327996,9713350,9963027,11991923,3562944,
622             4520396,7065629,2905597,12675100,10094378,5011336,3908274,3572588,
623             15618069,13341879,9470980,13327842,8432408,6344466,12241360,1543979,
624             12081229,11363884,983612,6025413,1848571,14318469,14906334,13381442,
625             3327004,15286722,14443922,9462145,15828870,16292084,128023,4199307,
626             12797648,6169450,6767468,8100201,9756312,10612295,2273164,3350998,
627             15889011,3661060,9395406,1435793,5752767,16441805,16677778,6475274,
628             12909030,15902971,3415473,9004053,645884,515610,8824322,16574526,
629             15956463,13265827,6333169,6924814,1812983,3392856,14761092,4985619,
630             7893816,13931135,14548854,11444226,9118923,1875105,7285192,2101733,
631             7801836,11517693,2349183,5939167,11937456,10886500,13866155,12947589,
632             9640186,5047153,1901666,715551,13790692,2933460,11212664,9563015,
633             16642428,16334427,7140601,4655671,15711153,750565,15067249,16737043,
634             12684416,15673315,2341376,8935324,3134061,10483409,337177,13018877,
635             16599994,7782302,1977121,10593779,9842381,14330646,1456639,3774065,
636             12844377,3016177,8933870,12263851,10455534,1612109,16302350,4895080,
637             12932155,1905228,10253063,4458040,16024500,15902756,16584305,12528008,
638             4171461,14536742,9219403,12927168,1979395,15257546,10619265,1967594,
639             1467515,2028519,2032612,3707709,4887462,2337860,183801,2152077,
640             15066473,3694942,8424967,15508266,13386596,6059869,10531128,13828874,
641             7119662,5064756,12552069,5922533,802911,5645620,10781530,11246590,
642             9323418,16275234,2144845,10962831,4925357,1704524,9227431,13641289,
643             8489002,1225340,8659144,8671408,13461400,4992933,13370774,8568931,
644             2412794,1312411,12429994,1025208,478829,11399895,2242158,2332498,
645             10717459,8151843,5288043,7235700,9162569,14017735,10412273,12712138,
646             11844638,11163643,7756823,9956164,14078510,8442139,2116890,10881649,
647             16223710,8592664,15408035,6522496,1261635,14685232,5071601,10144049,
648             967751,7873356,5595700,10647000,15126220,1237821,321796,6173902,
649             14476409,1830511,12766190,14322080,8483740,13438254,1854079,6215655,
650             11575352,15129118,16393883,16560142,9079559,11379168,6198702,11864074,
651             2282933,16547051,7156233,15740343,4809601,2344447,10219155,4977972,
652             13592880,184650,16420038,3165940,9418081,13446140,179241,9394692,
653             6213074,1752099,3516715,16081239,13222615,1499877,9066661,12702088,
654             10706447,7629231,13016955,1069166,1089471,6809842,15634321,1288782,
655             1183469,9576844,14191973,2814257,4260748,5239952,4277681,4629271,
656             8220928,8766876,7388663,13090704,15838538,11015909,7814987,14448125,
657             13000849,15596437,2104764,8398024,15653431,3695833,6613072,13626967,
658             2665818,9249819,4040305,8029033,4822667,3844052,14708928,690088
659         };
660
661         int[] to_remove = new int[] {
662             9707851,7941420,9178562,2165498,4160722,5570057,1774305,11340758,
663             10326974,8644308
664         };
665
666         for( int i = 0 ; i < to_add.length; i++ ) {
667             Integer JavaDoc obj = new Integer JavaDoc( to_add[ i ] );
668             map.put( obj, obj );
669         }
670
671         for( int i = 0; i < to_remove.length; i++ ) {
672             Integer JavaDoc obj = new Integer JavaDoc( to_remove[ i ] );
673             map.remove( obj );
674         }
675     }
676 } // THashMapTests
677
Popular Tags