Code example for ListIterator

Methods: hasNext, next

0
     * 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 = lineIter.next();
            Matcher m = numPattern.matcher(line);
            if (m.matches()) {
                retval = Integer.parseInt(m.group(1));
            } 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",
                    numPattern));
        } 
 
        return retval;
    }