當前位置: 首頁>>代碼示例>>Java>>正文


Java List.toArray方法代碼示例

本文整理匯總了Java中com.sun.tools.javac.util.List.toArray方法的典型用法代碼示例。如果您正苦於以下問題:Java List.toArray方法的具體用法?Java List.toArray怎麽用?Java List.toArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.sun.tools.javac.util.List的用法示例。


在下文中一共展示了List.toArray方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: validOptions

import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
/**
 * Let doclet check that all options are OK. Returning true means
 * options are OK.  If method does not exist, assume true.
 */
public boolean validOptions(List<String[]> optlist) {
    Object retVal;
    String options[][] = optlist.toArray(new String[optlist.length()][]);
    String methodName = "validOptions";
    DocErrorReporter reporter = messager;
    Class<?>[] paramTypes = { String[][].class, DocErrorReporter.class };
    Object[] params = { options, reporter };
    try {
        retVal = invoke(methodName, Boolean.TRUE, paramTypes, params);
    } catch (DocletInvokeException exc) {
        return false;
    }
    if (retVal instanceof Boolean) {
        return ((Boolean)retVal).booleanValue();
    } else {
        messager.error(Messager.NOPOS, "main.must_return_boolean",
                       docletClassName, methodName);
        return false;
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:25,代碼來源:DocletInvoker.java

示例2: validOptions

import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
/**
 * Let doclet check that all options are OK. Returning true means
 * options are OK.  If method does not exist, assume true.
 */
public boolean validOptions(List<String[]> optlist) {
    Object retVal;
    String options[][] = optlist.toArray(new String[optlist.length()][]);
    String methodName = "validOptions";
    DocErrorReporter reporter = messager;
    Class<?>[] paramTypes = { String[][].class, DocErrorReporter.class };
    Object[] params = { options, reporter };
    try {
        retVal = invoke(methodName, Boolean.TRUE, paramTypes, params);
    } catch (DocletInvokeException exc) {
        return false;
    }
    if (retVal instanceof Boolean) {
        return ((Boolean)retVal);
    } else {
        messager.error(Messager.NOPOS, "main.must_return_boolean",
                       docletClassName, methodName);
        return false;
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:25,代碼來源:DocletInvoker.java

示例3: test

import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
void test(List<String> list, String[] array) {
    String[] result = list.toArray(array);

    if (result.length < list.size()) {
        error("returned array is too small; expected: " + list.size() + ", found: " + result.length);
        return;
    }

    if (list.size() <= array.length && result != array)
        error("new array wrongly created");

    int i = 0;
    for (String s: list)
        check(result, i++, s);

    if (i < result.length)
        check(result, i, null);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:19,代碼來源:T6238612.java

示例4: allClasses

import com.sun.tools.javac.util.List; //導入方法依賴的package包/類
/**
 * Get all classes (including Exceptions and Errors)
 * and interfaces.
 * @since J2SE1.4.
 *
 * @return all classes and interfaces in this package, filtered to include
 * only the included classes if filter==true.
 */
public ClassDoc[] allClasses(boolean filter) {
    List<ClassDocImpl> classes = getClasses(filter);
    return classes.toArray(new ClassDocImpl[classes.length()]);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:13,代碼來源:PackageDocImpl.java


注:本文中的com.sun.tools.javac.util.List.toArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。