List<Employee> query6 = db.query(new Predicate<Employee>() {
public boolean match(Employee employee) {
boolean result6 = employee.getDepartment().getLocation().getCountry().equals("US");
return result6;
}
});
Iterator<Employee> it = query6.iterator();
System.out.println("element next is "+it.next());
double total_sal=0;
while(it.hasNext()) {
total_sal=total_sal+it.next().getSalary();
}
final double average_sal = total_sal/query6.size();
//System.out.println("element next is "+query6.get(0));
it = query6.iterator();
System.out.println("element next is "+it.next().getSalary());
boolean result7 = it.next().getSalary();
//System.out.println("element next is "+query6.iterator().next());
List<Employee> query7 = db.query(new Predicate<Employee>() {
public boolean match(Employee employee) {
boolean result8 = it.next().getSalary()>average_sal;
boolean result7 =average_sal>0;
return result7;
}
});
listResult(query7);
}
wywala mi bład ze local variable is accessed from within inner class need to be final
jednak jak dam final zto znowu nie moge iteratora ustawic na poczatek: tak "it = query6.iterator(); ";
Ani tak ani tak, jestem w martwym punkcie !