-1
我已經創建如下所示的數據結構的數據結構是基於番石榴表,並將其顯示在下面遍歷集合上的特定條件中
final Table<String, String, List<String>> values = HashBasedTable.create();
values.put("bon", "currency", Lists.newArrayList("ccdd","rode1","cwey","Certy"));
下面
谷歌是其中我的方式遍歷這個集合
Map <String , List<String>>fmap = new HashMap < String , List<String>>();
for (Cell<String, String, List<String>> cell1: values.cellSet()){
if (cell1.getRowKey() != null && cell1.getRowKey().equalsIgnoreCase("bon"))
{
fmap.put(cell1.getColumnKey(), cell1.getValue());
}
}
現在我想修改我的病情以這樣的方式,如果行鍵包含苯教 的價值和列項中包含這些值「CCDD」,「rode1」,「cwey」 ,「Certy」則應填寫地圖 名爲FMAP使得在迭代地圖看起來像這樣
Key Value
ccdd currency
rode1 currency
cwey currency
Certy currency
請指教如何實現這一目標 作爲解決方案的建議是還是不是相反穿過番石榴表中的所有值進行迭代工作,請
你試過了什麼? – 2015-06-22 05:14:57
if(cell1.getRowKey()!= null && cell1.getRowKey()。equalsIgnoreCase(「bon」)cell1.getColumnKey()。contains(「ccdd」,「rode1」,「cwey」,「Certy」)) – user1906154
夥計們請告知 – user1906154