1

単純なint カウントフィールドを持つ MyBean クラスと、次のような Guava テーブルがあるとします。

Table<Integer, Integer, MyBean> table; // we can instantiate like HashBasedTable.create();

新しいMyBeanオブジェクトを配置し、この位置に既存のMyBeanオブジェクトがテーブルにある場合、カウントフィールドを合計したい。

table.put(1, 1, new MyBean(1)); 
table.put(1, 1, new MyBean(2)); // so what will be going on ?

実際、これは非常に単純なケースであり、衝突している場合は複雑なオブジェクトで作業したいと考えています。

4

1 に答える 1