本文整理匯總了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()]);
}