2012-09-01 8 views
3

다음 설정이 있습니다.Guava의 HashBasedTable 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()) 

에서 발생 내가 뭘 잘못 볼 수 없습니다를 이리. 내가 확인한 상점에 ​​적어도 1 개의 항목이 있습니다.

+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()); 
} 
관련 문제