Add a DoubleArray example using ChronicleMap

This commit is contained in:
Peter Lawrey
2015-04-28 14:23:36 +01:00
parent 6d04f566ce
commit 6d5cd507b7
2 changed files with 37 additions and 1 deletions
@@ -1,5 +1,7 @@
package net.openhft.lang.values;
import net.openhft.chronicle.map.ChronicleMap;
import net.openhft.chronicle.map.ChronicleMapBuilder;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
@@ -45,4 +47,23 @@ public class DoubleArrayTest {
// free the memory.
da.bytes().release();
}
@Test
public void addToAMap() {
DoubleArray a = new DoubleArray(10);
a.setData(new double[]{1, 2, 3, 4, 5});
DoubleArray b = new DoubleArray(10);
b.setData(new double[]{5, 6, 7, 8, 9});
ChronicleMap<Integer, DoubleArray> proxyMap = ChronicleMapBuilder.of(Integer.class, DoubleArray.class)
.create();
proxyMap.put(1, a);
proxyMap.put(2, b);
System.out.println(proxyMap.get(1));
System.out.println(proxyMap.get(2));
proxyMap.close();
}
}