@Override
    public boolean hasNext() {
        if (currentIterator == null || !currentIterator.hasNext()) {
            while (listIterator.hasNext()) {
                Iterator<T> iterator = listIterator.next();
                currentIterator = iterator;
                if (iterator.hasNext()) {
                    if (limit == 0) {
                        return true;
                    } else {
                        return limit >= counter + 1;
                    }
                }
            }
            return false;
        }

        if (currentIterator.hasNext()) {
            if (limit == 0) {
                return true;
            } else {
                return limit >= counter + 1;
            }
        }
        return false;
    }
@Test
	public void testHasNextWithEmpty() {
		List<Integer> emptyList = new ArrayList<Integer>();
		CompositeIterable<Integer> compositeIterable = new CompositeIterable<Integer>(
				emptyList);
		assertThat(compositeIterable.iterator().hasNext()).isFalse();
	}