コード例 #1
0
 @Test
 public void testOverSize() {
   long[] keys = {3, 7, 9};
   double[] values = {Math.PI, Math.E, 0.42};
   ImmutableSparseVector v = MutableSparseVector.wrap(keys, values, 2).freeze();
   assertThat(v.size(), equalTo(2));
   assertThat(v.containsKey(9), equalTo(false));
   assertThat(v.get(9, Double.NaN), notANumber());
   assertThat(v.get(3), closeTo(Math.PI));
   assertThat(v.containsKey(9), equalTo(false));
 }
コード例 #2
0
 @Override
 protected ImmutableSparseVector simpleVector2() {
   long[] keys = {3, 5, 8};
   double[] values = {2, 2.3, 1.7};
   return MutableSparseVector.wrap(keys, values).freeze();
 }
コード例 #3
0
 @Override
 protected ImmutableSparseVector singleton() {
   return MutableSparseVector.wrap(new long[] {5}, new double[] {Math.PI}).freeze();
 }
コード例 #4
0
 @Override
 protected ImmutableSparseVector simpleVector() {
   long[] keys = {3, 7, 8};
   double[] values = {1.5, 3.5, 2};
   return MutableSparseVector.wrap(keys, values).freeze();
 }