本文整理汇总了Java中com.google.common.collect.HashBasedTable.put方法的典型用法代码示例。如果您正苦于以下问题:Java HashBasedTable.put方法的具体用法?Java HashBasedTable.put怎么用?Java HashBasedTable.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.collect.HashBasedTable
的用法示例。
在下文中一共展示了HashBasedTable.put方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testCreate
import com.google.common.collect.HashBasedTable; //导入方法依赖的package包/类
@Test
public void testCreate() {
HashBasedTable<String, String, String> table = HashBasedTable.create();
table.put("cbooy", "vm", "10.94.97.94");
table.put("cbooy", "name", "haoc");
table.put("hello", "name", "hi");
table.put("hello", "vm", "10999");
System.out.println(table);
// 遍历
table.cellSet().forEach(cell -> {
String columnKey = cell.getColumnKey();
String rowKey = cell.getRowKey();
String value = cell.getValue();
System.out.println(String.format("%s-%s-%s", rowKey, columnKey, value));
});
}
示例2: register
import com.google.common.collect.HashBasedTable; //导入方法依赖的package包/类
public static void register(final Kryo kryo) {
// register list
final ImmutableListSerializer serializer = new ImmutableListSerializer();
kryo.register(ImmutableList.class, serializer);
kryo.register(ImmutableList.of().getClass(), serializer);
kryo.register(ImmutableList.of(Integer.valueOf(1)).getClass(), serializer);
kryo.register(ImmutableList.of(Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3)).subList(1, 2).getClass(), serializer);
kryo.register(ImmutableList.of().reverse().getClass(), serializer);
kryo.register(Lists.charactersOf("dremio").getClass(), serializer);
final HashBasedTable baseTable = HashBasedTable.create();
baseTable.put(Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3));
baseTable.put(Integer.valueOf(4), Integer.valueOf(5), Integer.valueOf(6));
ImmutableTable table = ImmutableTable.copyOf(baseTable);
kryo.register(table.values().getClass(), serializer);
}
示例3: a
import com.google.common.collect.HashBasedTable; //导入方法依赖的package包/类
public void a(Map<Map<IBlockState<?>, Comparable<?>>, BlockStateList.BlockData> map) {
if (this.c != null) {
throw new IllegalStateException();
} else {
HashBasedTable hashbasedtable = HashBasedTable.create();
Iterator iterator = this.b.entrySet().iterator();
while (iterator.hasNext()) {
Entry entry = (Entry) iterator.next();
IBlockState iblockstate = (IBlockState) entry.getKey();
Iterator iterator1 = iblockstate.c().iterator();
while (iterator1.hasNext()) {
Comparable comparable = (Comparable) iterator1.next();
if (comparable != entry.getValue()) {
hashbasedtable.put(iblockstate, comparable, map.get(this.b(iblockstate, comparable)));
}
}
}
this.c = ImmutableTable.copyOf(hashbasedtable);
}
}
示例4: mockUploadS3File
import com.google.common.collect.HashBasedTable; //导入方法依赖的package包/类
private PutObjectResult mockUploadS3File(String bucket, String key, byte[] contents, HashBasedTable<String, String, ByteBuffer> s3FileTable) {
// Place the contents in the s3 file table keyed by the file's parent directory and file name
int idx = key.lastIndexOf('/');
String parentDir = key.substring(0, idx);
String fileName = key.substring(idx + 1);
// HashBasedTable is not thread-safe if multiple threads try to write to the same directory concurrently
synchronized (s3FileTable) {
s3FileTable.put(format("%s/%s", bucket, parentDir), fileName, ByteBuffer.wrap(contents));
}
PutObjectResult result = new PutObjectResult();
result.setETag("etag");
return result;
}
示例5: generateHashBasedTable
import com.google.common.collect.HashBasedTable; //导入方法依赖的package包/类
@Generates
private static <R, C, V> HashBasedTable<R, C, V> generateHashBasedTable(
R row, C column, V value) {
HashBasedTable<R, C, V> table = HashBasedTable.create();
table.put(row, column, value);
return table;
}
示例6: generateHashBasedTable
import com.google.common.collect.HashBasedTable; //导入方法依赖的package包/类
@Generates private static <R, C, V> HashBasedTable<R, C, V> generateHashBasedTable(
R row, C column, V value) {
HashBasedTable<R, C, V> table = HashBasedTable.create();
table.put(row, column, value);
return table;
}
示例7: addPriceValue
import com.google.common.collect.HashBasedTable; //导入方法依赖的package包/类
private void addPriceValue(final HashBasedTable<Optional<String>, Optional<Locale>, String> table,
final PriceInformation priceInformation)
{
final String value = String.format(java.util.Locale.US, "%.2f", new Double(priceInformation.getPriceValue().getValue()));
table.put(Optional.empty(), Optional.empty(), value);
}