@Test public void testGetValues() throws Throwable { List<CKeyValue> keys = new ArrayList<CKeyValue>(); keys.add(new CKeyValue(new byte[] { 1 }, new byte[] { 2 }, new byte[] { 3 }, new byte[] { 4 })); keys.add(new CKeyValue(new byte[] { 1 }, new byte[] { 2 }, new byte[] { 5 }, new byte[] { 4, 1 })); keys.add(new CKeyValue(new byte[] { 1 }, new byte[] { 6 }, new byte[] { 5 }, new byte[] { 4 })); keys.add(new CKeyValue(new byte[] { 2 }, new byte[] { 2 }, new byte[] { 3 }, new byte[] { 4 })); Result result = new Result(keys.toArray(new CKeyValue[0])); Assert.assertArrayEquals(new byte[] { 4 }, result.getValue(new byte[] { 2 }, new byte[] { 3 }).getValue()); Assert.assertArrayEquals(new byte[] { 4, 1 }, result.getValue(new byte[] { 2 }, new byte[] { 5 }).getValue()); Assert.assertArrayEquals(new byte[] { 4 }, result.getValue(new byte[] { 6 }, new byte[] { 5 }).getValue()); Assert.assertArrayEquals(new byte[] { 4 }, result.getValue(new byte[] { 2 }, new byte[] { 3 }).getValue()); Assert.assertEquals(null, result.getValue(new byte[] { 2 }, new byte[] { 2 })); }
public CKeyValue getValue(byte[] family, byte[] qualifier) { if (this.values.size() == 0) return null; int index = Collections.binarySearch(values, new CKeyValue(this.recordId, family, qualifier), KeyComparator.INSTANCE); if (index < 0) return null; return values.get(index); }
Result implements Writable { public CKeyValue getValue(byte[] family, byte[] qualifier) { if (this.values.size() == 0) return null; int index = Collections.binarySearch(values, new CKeyValue(this.recordId, family, qualifier), KeyComparator.INSTANCE); if (index < 0) return null; return values.get(index); } }
Result implements Writable { public CKeyValue getValue(byte[] family, byte[] qualifier) { if (this.values.size() == 0) return null; int index = Collections.binarySearch(values, new CKeyValue(this.recordId, family, qualifier), KeyComparator.INSTANCE); if (index < 0) return null; return values.get(index); } Result();  Result(byte[] recordID);  Result(byte[] rowId, CKeyValue... keyValues);  Result(CKeyValue... keyValues);  Result(Iterable<CKeyValue> keyValues); }
Result implements Writable { public CKeyValue getValue(byte[] family, byte[] qualifier) { if (this.values.size() == 0) return null; int index = Collections.binarySearch(values, new CKeyValue(this.recordId, family, qualifier), KeyComparator.INSTANCE); if (index < 0) return null; return values.get(index); } Result();  Result(byte[] recordID);  Result(byte[] rowId, CKeyValue... keyValues);  Result(CKeyValue... keyValues);  Result(Iterable<CKeyValue> keyValues); byte[] getRecordId(); List<CKeyValue> getKeyValues(); CKeyValue getValue(byte[] family, byte[] qualifier); void setRecordId(byte[] recordId); void setValues(CKeyValue... values); @Override void readFields(DataInput in); @Override void write(DataOutput out); void copy(Result result); void addKeyValues(CKeyValue... kvs); }
Result implements Writable { public CKeyValue getValue(byte[] family, byte[] qualifier) { if (this.values.size() == 0) return null; int index = Collections.binarySearch(values, new CKeyValue(this.recordId, family, qualifier), KeyComparator.INSTANCE); if (index < 0) return null; return values.get(index); } Result();  Result(byte[] recordID);  Result(byte[] rowId, CKeyValue... keyValues);  Result(CKeyValue... keyValues);  Result(Iterable<CKeyValue> keyValues); byte[] getRecordId(); List<CKeyValue> getKeyValues(); CKeyValue getValue(byte[] family, byte[] qualifier); void setRecordId(byte[] recordId); void setValues(CKeyValue... values); @Override void readFields(DataInput in); @Override void write(DataOutput out); void copy(Result result); void addKeyValues(CKeyValue... kvs);  }