package api; import java.io.IOException;
import java.util.ArrayList;
import java.util.List; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.util.Bytes; public class PutListEx { public static void main(String[] args) throws IOException {
Configuration cfg = HBaseConfiguration.create(); HTable table = new HTable(cfg,"xyj"); List<Put> putlist= new ArrayList<Put>(); Put put1 =new Put(Bytes.toBytes("row7"));
put1.add(Bytes.toBytes("cf1"),Bytes.toBytes("qual7"),Bytes.toBytes("val7"));
putlist.add(put1); Put put2 =new Put(Bytes.toBytes("row8"));
put2.add(Bytes.toBytes("cf1"),Bytes.toBytes("qual8"),Bytes.toBytes("val8"));
putlist.add(put2); Put put3 =new Put(Bytes.toBytes("row9"));
put3.add(Bytes.toBytes("cf1"),Bytes.toBytes("qual9"),Bytes.toBytes("val9"));
putlist.add(put3); table.put(putlist); }
} //hbase(main):029:0> scan 'xyj'
//ROW COLUMN+CELL
// r1 column=cf1:q1, timestamp=1511597241994, value=v1
// r2 column=cf1:q2, timestamp=1511597275233, value=v2
// r2 column=cf1:q3, timestamp=1511597290730, value=v3
// r3 column=cf1:qual1, timestamp=1511597438929, value=val1
// r3 column=cf1:qual2, timestamp=1511597438929, value=val2
// r3 column=cf1:qual3, timestamp=1511597438929, value=val3
// row4 column=cf1:qual4, timestamp=1511599731428, value=val4
// row5 column=cf1:qual5, timestamp=1511599731428, value=val5
// row6 column=cf1:qual6, timestamp=1511599731428, value=val6
// row7 column=cf1:qual7, timestamp=1511600215514, value=val7
// row8 column=cf1:qual8, timestamp=1511600215514, value=val8
// row9 column=cf1:qual9, timestamp=1511600215514, value=val9
//9 row(s) in 0.0680 seconds