2012-09-01 106 views
3

我有以下設置。番石榴的HashBaseTable cellSet()

Table<Integer, Integer, Float> store = HashBasedTable.create(); 

int i = 0, j = 0; 

for (List<String> stack_i : stacks) { 
    j = 0; 

    for (String entry_j : stack_i) { 
    Float alpha = doSomeMagic(entry_j, token); 
    if (alpha != null) 
     store.put(i, j, alpha); 
    j++; 
    } 
    i++; 
} 

if (store.cellSet().size() > 0) { 
    for (Table.Cell<Integer, Integer, Float> cell : store.cellSet()) { 
    if (cell.getValue() > max) { 
     max = cell.getValue(); 
     maxchainIndex = cell.getRowKey(); 
    } 
    } 
} 

我遇到我是得到以下JVM錯誤的問題:

SEVERE: java.lang.IllegalAccessError: tried to access method com.google.common.collect.Iterators.emptyModifiableIterator()Ljava/util/Iterator; from class com.google.common.collect.StandardTable$CellIterator at com.google.common.collect.StandardTable$CellIterator.(StandardTable.java:310) at com.google.common.collect.StandardTable$CellIterator.(StandardTable.java:306) at com.google.common.collect.StandardTable$CellSet.iterator(StandardTable.java:280)

在行

for(Table.Cell<Integer,Integer,Float> cell:store.cellSet()) 

出現的錯誤,我不能看到我在做什麼錯這裏。我已經檢查過,店裏至少有一件物品。

+3

您能否提供一個代碼示例,我們可以編譯並運行自己來重現錯誤? –

回答

0

對我來說看起來不錯,我能夠成功運行以下內容。你可以運行它沒有任何額外的元素,以消除任何有趣的業務無關for循環?

Table<Integer, Integer, Double> abc = HashBasedTable.create(); 
abc.put(1, 1, 10d); 
for (Table.Cell<Integer, Integer, Double> x : abc.cellSet()) { 
    System.out.println(x.toString()); 
}