/* */ private void writeObject(ObjectOutputStream s) throws IOException { /* 809 */ Object[] key = this.key; /* 810 */ double[] value = this.value; /* 811 */ MapIterator i = new MapIterator(null); /* 812 */ s.defaultWriteObject(); /* 813 */ for (int j = this.size; j-- != 0; ) { /* 814 */ int e = i.nextEntry(); /* 815 */ s.writeObject(key[e]); /* 816 */ s.writeDouble(value[e]); /* */ } /* */ }
/* */ private void writeObject(ObjectOutputStream s) throws IOException { /* 791 */ long[] key = this.key; /* 792 */ boolean[] value = this.value; /* 793 */ MapIterator i = new MapIterator(null); /* 794 */ s.defaultWriteObject(); /* 795 */ for (int j = this.size; j-- != 0; ) { /* 796 */ int e = i.nextEntry(); /* 797 */ s.writeLong(key[e]); /* 798 */ s.writeBoolean(value[e]); /* */ } /* */ }
private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException { final double key[] = this.key; final double value[] = this.value; final MapIterator i = new MapIterator(); s.defaultWriteObject(); for (int j = size, e; j-- != 0; ) { e = i.nextEntry(); s.writeDouble(key[e]); s.writeDouble(value[e]); } }
/* */ private void writeObject(ObjectOutputStream s) throws IOException { /* 800 */ long[] key = this.key; /* 801 */ byte[] value = this.value; /* 802 */ MapIterator i = new MapIterator(null); /* 803 */ s.defaultWriteObject(); /* 804 */ for (int j = this.size; j-- != 0; ) { /* 805 */ int e = i.nextEntry(); /* 806 */ s.writeLong(key[e]); /* 807 */ s.writeByte(value[e]); /* */ } /* */ }
/* */ private void writeObject(ObjectOutputStream s) throws IOException { /* 1244 */ float[] key = this.key; /* 1245 */ char[] value = this.value; /* 1246 */ MapIterator i = new MapIterator(null); /* 1247 */ s.defaultWriteObject(); /* 1248 */ for (int j = this.size; j-- != 0; ) { /* 1249 */ int e = i.nextEntry(); /* 1250 */ s.writeFloat(key[e]); /* 1251 */ s.writeChar(value[e]); /* */ } /* */ }
/* */ private void writeObject(ObjectOutputStream s) throws IOException { /* 1284 */ long[] key = this.key; /* 1285 */ short[] value = this.value; /* 1286 */ MapIterator i = new MapIterator(null); /* 1287 */ s.defaultWriteObject(); /* 1288 */ for (int j = this.size; j-- != 0; ) { /* 1289 */ int e = i.nextEntry(); /* 1290 */ s.writeLong(key[e]); /* 1291 */ s.writeShort(value[e]); /* */ } /* */ }
/* */ private void writeObject(ObjectOutputStream s) throws IOException { /* 788 */ Object[] key = this.key; /* 789 */ int[] value = this.value; /* 790 */ MapIterator i = new MapIterator(null); /* 791 */ s.defaultWriteObject(); /* 792 */ for (int j = this.size; j-- != 0; ) { /* 793 */ int e = i.nextEntry(); /* 794 */ s.writeObject(key[e]); /* 795 */ s.writeInt(value[e]); /* */ } /* */ }
@Override public void remove() { super.remove(); entry.index = -1; // You cannot use a deleted entry. }
public void remove() { super.remove(); }
@Test public void testReadableMap() { final IterableMap<String, Integer> map = SplitMapUtils.readableMap(transformedMap); // basic for (int i = 0; i < 10; i++) { assertFalse(map.containsValue(String.valueOf(i))); assertEquals(i, map.get(String.valueOf(i)).intValue()); } // mapIterator final MapIterator<String, Integer> it = map.mapIterator(); while (it.hasNext()) { final String k = it.next(); assertEquals(k, it.getKey()); assertEquals(Integer.valueOf(k), it.getValue()); } // unmodifiable assertTrue(map instanceof Unmodifiable); // check individual operations int sz = map.size(); attemptPutOperation( new Runnable() { public void run() { map.clear(); } }); assertEquals(sz, map.size()); attemptPutOperation( new Runnable() { public void run() { map.put("foo", 100); } }); final HashMap<String, Integer> m = new HashMap<String, Integer>(); m.put("foo", 100); m.put("bar", 200); m.put("baz", 300); attemptPutOperation( new Runnable() { public void run() { map.putAll(m); } }); // equals, hashcode final IterableMap<String, Integer> other = SplitMapUtils.readableMap(transformedMap); assertEquals(other, map); assertEquals(other.hashCode(), map.hashCode()); // remove for (int i = 0; i < 10; i++) { assertEquals(i, map.remove(String.valueOf(i)).intValue()); assertEquals(--sz, map.size()); } assertTrue(map.isEmpty()); assertSame(map, SplitMapUtils.readableMap(map)); }