2012-09-01 104 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()); 
}