当前位置: 首页>>代码示例>>Java>>正文


Java HashBasedTable.put方法代码示例

本文整理汇总了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));
    });
}
 
开发者ID:cbooy,项目名称:cakes,代码行数:21,代码来源:HashBasedTableDemo.java

示例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);
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:17,代码来源:ImmutableCollectionSerializers.java

示例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);
    }
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:25,代码来源:BlockStateList.java

示例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;
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:15,代码来源:ScanUploaderTest.java

示例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;
}
 
开发者ID:google,项目名称:guava,代码行数:8,代码来源:FreshValueGenerator.java

示例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;
}
 
开发者ID:zugzug90,项目名称:guava-mock,代码行数:7,代码来源:FreshValueGenerator.java

示例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);
}
 
开发者ID:fredhopper,项目名称:hybris-connector,代码行数:7,代码来源:ProductPriceValueProvider.java


注:本文中的com.google.common.collect.HashBasedTable.put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。