public Iterable<QueryAndLimit> queriesIterable() { return new Iterable<QueryAndLimit>() { @Override public Iterator<QueryAndLimit> iterator() { return new Iterator<QueryAndLimit>() { private final Iterator<Map.Entry<Query,Integer>> iter = queries.entrySet().iterator(); @Override public boolean hasNext() { return iter.hasNext(); } @Override public QueryAndLimit next() { final Map.Entry<Query,Integer> ent = iter.next(); return new QueryAndLimit(ent.getKey(), ent.getValue()); } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; }
public Iterable<QueryAndLimit> queriesIterable() { return new Iterable<QueryAndLimit>() { @Override public Iterator<QueryAndLimit> iterator() { return new Iterator<QueryAndLimit>() { private int upto; @Override public boolean hasNext() { return upto < queries.length; } @Override public QueryAndLimit next() { QueryAndLimit ret = new QueryAndLimit(queries[upto], queryLimits[upto]); upto++; return ret; } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; }