当前位置: 首页>>代码示例>>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;未经允许,请勿转载。