Java List First Item getStringFirstResult(List> llo, String reason)

Here you can find the source of getStringFirstResult(List> llo, String reason)

Description

Gets the string first result.

License

Open Source License

Parameter

Parameter Description
llo the llo
reason the reason

Return

the string first result

Declaration

public static String getStringFirstResult(List<List<Object>> llo,
        String reason) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.List;

public class Main {
    /**//  ww  w .  j  ava 2s. c o m
     * Gets the string first result.
     *
     * @param llo the llo
     * @param reason the reason
     * @return the string first result
     */
    public static String getStringFirstResult(List<List<Object>> llo,
            String reason) {
        Object o = getNthResult(llo, 0, reason);
        if (!(o instanceof String))
            throw new RuntimeException("Result not String, " + reason);
        return (String) getNthResult(llo, 0, reason);
    }

    /**
     * Gets the nth result.
     *
     * @param llo the llo
     * @param n the n
     * @param reason the reason
     * @return the nth result
     */
    public static Object getNthResult(List<List<Object>> llo, int n,
            String reason) {
        if (llo.size() < 1)
            throw new RuntimeException("Insufficient row results, "
                    + reason);
        if (llo.get(0).size() < n + 1)
            throw new RuntimeException("Insufficient column results, "
                    + reason);
        return llo.get(0).get(n);
    }
}

Related

  1. getIndexOfFirstMatchingProperty(List propertyNames, String follower)
  2. getListBetween(String inputStr, String first, String second, List list)
  3. getNFirstBytes(int n, List byteList)
  4. getOnlyFirst(List obj)
  5. getPage(List all, int first, int pageSize)
  6. hasSameElement(List firstList, List secondList)
  7. isFirst(List list, V object)
  8. isFirstAnnotationOfMethod(List lines, int lineNumber)
  9. isFirstPage(List pageLines, List> rawPages)