Code example for ListIterator

Methods: hasNextnext

     * Use the provided {@link Pattern} to parse a number out of the output file 
    private Integer getIntFromOutput(ListIterator<String> lineIter, Pattern numPattern) {
        Integer retval = null;
        String line = null;
        if (lineIter.hasNext()) {
            line =;
            Matcher m = numPattern.matcher(line);
            if (m.matches()) {
                retval = Integer.parseInt(;
            } else { 
                Log.e(LOG_TAG, String.format("Couldn't match pattern %s against line '%s'",
                        numPattern, line));
        } else { 
            Log.e(LOG_TAG, String.format("Encounted EOF while trying to match pattern %s",
        return retval;
Connect your IDE to all the code out there  Get Codota for Java