本文整理汇总了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;
}
}
示例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;
}
}
示例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);
}
示例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()]);
}