本文整理汇总了C#中java.util.ArrayList.toArray方法的典型用法代码示例。如果您正苦于以下问题:C# ArrayList.toArray方法的具体用法?C# ArrayList.toArray怎么用?C# ArrayList.toArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.ArrayList
的用法示例。
在下文中一共展示了ArrayList.toArray方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: sort
public static void sort(List modules)
{
HashMap hashMap = new HashMap();
ArrayList arrayList1 = new ArrayList();
ArrayList arrayList2 = new ArrayList();
for (int index = 0; index < modules.size(); ++index)
{
PackageState packageState = (PackageState) modules.get(index);
if (packageState.getState() == -2)
{
arrayList1.add((object) packageState);
}
else
{
PackageSorter.SortModule sortModule = new PackageSorter.SortModule(packageState);
arrayList2.add((object) sortModule);
hashMap.put((object) packageState.getModule().getModuleClass(), (object) sortModule);
}
}
PackageSorter.SortModule[] sortModuleArray = (PackageSorter.SortModule[]) arrayList2.toArray((object[]) new PackageSorter.SortModule[arrayList2.size()]);
for (int index = 0; index < sortModuleArray.Length; ++index)
{
PackageSorter.SortModule sortModule = sortModuleArray[index];
sortModule.setDependSubsystems(PackageSorter.collectSubsystemModules(sortModule.getState().getModule(), hashMap));
}
int num1 = 1;
label_10:
while (num1 != 0)
{
num1 = 0;
int index = 0;
while (true)
{
if (index < sortModuleArray.Length)
{
PackageSorter.SortModule sortModule = sortModuleArray[index];
int num2 = PackageSorter.searchModulePosition(sortModule, hashMap);
if (num2 != sortModule.getPosition())
{
sortModule.setPosition(num2);
num1 = 1;
}
++index;
}
else
goto label_10;
}
}
Arrays.sort((object[]) sortModuleArray);
modules.clear();
for (int index = 0; index < sortModuleArray.Length; ++index)
modules.add((object) sortModuleArray[index].getState());
for (int index = 0; index < arrayList1.size(); ++index)
modules.add(arrayList1.get(index));
}
示例2: getDependencies
public virtual BootableProjectInfo[] getDependencies()
{
ArrayList arrayList = new ArrayList();
foreach (Library library in this.getLibraries())
{
if (library is BootableProjectInfo)
arrayList.add((object) library);
}
foreach (Library library in this.getOptionalLibraries())
{
if (library is BootableProjectInfo)
arrayList.add((object) library);
}
return (BootableProjectInfo[]) arrayList.toArray((object[]) new BootableProjectInfo[arrayList.size()]);
}
示例3: getActiveModules
public virtual Module[] getActiveModules()
{
ArrayList arrayList = new ArrayList();
for (int index = 0; index < this.modules.size(); ++index)
{
PackageState packageState = (PackageState) this.modules.get(index);
if (packageState.getState() == 2)
arrayList.add((object) packageState.getModule());
}
return (Module[]) arrayList.toArray((object[]) new Module[arrayList.size()]);
}
示例4: getOptionalLibraries
public virtual Library[] getOptionalLibraries()
{
ArrayList arrayList = new ArrayList();
for (int index = 0; index < this.optionalLibraries.size(); ++index)
{
Library library = ((BasicProjectInfo.OptionalLibraryHolder) this.optionalLibraries.get(index)).getLibrary();
if (library != null)
arrayList.add((object) library);
}
return (Library[]) arrayList.toArray((object[]) new Library[arrayList.size()]);
}
示例5: parseVersions
private static string[] parseVersions([In] string obj0)
{
if (obj0 == null)
return new string[0];
ArrayList arrayList = new ArrayList();
StringTokenizer stringTokenizer = new StringTokenizer(obj0, ".");
while (stringTokenizer.hasMoreTokens())
arrayList.add((object) stringTokenizer.nextToken());
return (string[]) arrayList.toArray((object[]) new string[arrayList.size()]);
}
示例6: removeTarget
public virtual void removeTarget(LogTarget target)
{
if (target == null)
{
Throwable.__\u003CsuppressFillInStackTrace\u003E();
throw new NullPointerException();
}
else
{
ArrayList arrayList = new ArrayList();
arrayList.addAll((Collection) Arrays.asList((object[]) this.logTargets));
arrayList.remove((object) target);
LogTarget[] logTargetArray = new LogTarget[arrayList.size()];
this.logTargets = (LogTarget[]) arrayList.toArray((object[]) logTargetArray);
}
}