本文整理汇总了Java中java.util.Vector.toArray方法的典型用法代码示例。如果您正苦于以下问题:Java Vector.toArray方法的具体用法?Java Vector.toArray怎么用?Java Vector.toArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.Vector
的用法示例。
在下文中一共展示了Vector.toArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getGenericRules
import java.util.Vector; //导入方法依赖的package包/类
/**
* Gets the genericRules attribute of the YassLanguageFilter object
*
* @param data Description of the Parameter
* @return The genericRules value
*/
public String[] getGenericRules(Vector<YassSong> data) {
Vector<String> langs = new Vector<>();
for (Enumeration<?> e = data.elements(); e.hasMoreElements(); ) {
YassSong s = (YassSong) e.nextElement();
String lang = s.getLanguage();
if (lang == null || lang.length() < 1) {
continue;
}
if (!langs.contains(lang)) {
langs.addElement(lang);
}
}
Collections.sort(langs);
return langs.toArray(new String[langs.size()]);
}
示例2: parseBenchArgs
import java.util.Vector; //导入方法依赖的package包/类
String[] parseBenchArgs(StreamTokenizer tokens)
throws IOException, ConfigFormatException
{
Vector vec = new Vector();
for (;;) {
switch (tokens.ttype) {
case StreamTokenizer.TT_EOF:
case StreamTokenizer.TT_EOL:
return (String[]) vec.toArray(new String[vec.size()]);
case StreamTokenizer.TT_WORD:
case '"':
vec.add(tokens.sval);
tokens.nextToken();
break;
default:
throw new ConfigFormatException("unrecognized arg token " +
"on line " + tokens.lineno());
}
}
}
示例3: getAgents2StartFromAgentName
import java.util.Vector; //导入方法依赖的package包/类
/**
* Gets the description instances of the agents to start, identified by the agent name
*
* @param agentName the agent name
* @return the array of AgentClassElement4SimStart depending on the agent name
*/
public AgentClassElement4SimStart[] getAgents2StartFromAgentName(String agentName) {
AgentClassElement4SimStart[] ace4sArr = null;
Vector<AgentClassElement4SimStart> ace4sVector = new Vector<AgentClassElement4SimStart>();
for (int i = 0; i < this.agents2Start.size(); i++) {
AgentClassElement4SimStart ace4s = (AgentClassElement4SimStart) this.agents2Start.get(i);
if (ace4s.getStartAsName().equals(agentName)) {
ace4sVector.add(ace4s);
}
}
if (ace4sVector.size()!=0) {
ace4sArr = ace4sVector.toArray(new AgentClassElement4SimStart[ace4sVector.size()]);
}
return ace4sArr;
}
示例4: getAllDevices
import java.util.Vector; //导入方法依赖的package包/类
public String[] getAllDevices() {
Vector<String> devices = new Vector<String>();
// Parse each driver
Iterator<Driver> itdriv;
try {
itdriv = getDrivers().iterator();
while (itdriv.hasNext()) {
Driver driver = itdriv.next();
Iterator<File> itdev = driver.getDevices().iterator();
while (itdev.hasNext()) {
String device = itdev.next().getName();
String value = String.format("%s (%s)", device, driver.getName());
devices.add(value);
}
}
} catch (IOException e) {
e.printStackTrace();
}
return devices.toArray(new String[devices.size()]);
}
示例5: finalizeSubCurves
import java.util.Vector; //导入方法依赖的package包/类
public static void finalizeSubCurves(Vector<CurveLink> subcurves,
Vector<ChainEnd> chains) {
int numchains = chains.size();
if (numchains == 0) {
return;
}
if ((numchains & 1) != 0) {
throw new InternalError("Odd number of chains!");
}
ChainEnd[] endlist = new ChainEnd[numchains];
chains.toArray(endlist);
for (int i = 1; i < numchains; i += 2) {
ChainEnd open = endlist[i - 1];
ChainEnd close = endlist[i];
CurveLink subcurve = open.linkTo(close);
if (subcurve != null) {
subcurves.add(subcurve);
}
}
chains.clear();
}
示例6: removeProviders
import java.util.Vector; //导入方法依赖的package包/类
private static Provider[] removeProviders(String cipherAlg) {
Vector providers = new Vector();
boolean done = false;
while (!done) {
try {
Cipher c = Cipher.getInstance(cipherAlg);
Provider p = c.getProvider();
providers.add(p);
Security.removeProvider(p.getName());
} catch (NoSuchAlgorithmException nsae) {
done = true;
} catch (NoSuchPaddingException nspe) {
// should never happen
}
}
return (Provider[]) (providers.toArray(new Provider[0]));
}
示例7: parseHostList
import java.util.Vector; //导入方法依赖的package包/类
public static String[] parseHostList(String hosts) {
Matcher m = Pattern.compile("([^,\\[]+)(\\[(([^\\]])*)\\])?").matcher(
hosts);
Vector<String> list = new Vector<String>();
while (m.find()) {
String prefix = m.group(1);
String range = m.group(3);
if (range == null) {
list.add(prefix);
continue;
}
for (String x : range.split(",")) {
String[] y = x.split("-");
int start = Integer.parseInt(y[0]);
int end = y.length == 1 ? start : Integer.parseInt(y[1]);
for (int i = start; i <= end; i++)
list.add(prefix + i);
}
}
return list.toArray(new String[0]);
}
示例8: multiFind
import java.util.Vector; //导入方法依赖的package包/类
private String[] multiFind(String key) {
Vector value = new Vector();
for(int i = 0; i < _configs.size(); i++) {
Vector v = (Vector)_configs.elementAt(i);
for(int j = 0; j < v.size(); j++) {
String[] kv = (String[])v.elementAt(j);
if(kv[0].equals(key)) {
String foo = kv[1];
if(foo != null) {
value.remove(foo);
value.addElement(foo);
}
}
}
}
String[] result = new String[value.size()];
value.toArray(result);
return result;
}
示例9: getNativeNames
import java.util.Vector; //导入方法依赖的package包/类
@Override
protected String[] getNativeNames(String fontFileName,
String platformName) {
Vector nativeNames;
if ((nativeNames=(Vector)xlfdMap.get(fontFileName))==null) {
if (platformName == null) {
return null;
} else {
/* back-stop so that at least the name used in the
* font configuration file is known as a native name
*/
String []natNames = new String[1];
natNames[0] = platformName;
return natNames;
}
} else {
int len = nativeNames.size();
return (String[])nativeNames.toArray(new String[len]);
}
}
示例10: MergedLogSourceIterator
import java.util.Vector; //导入方法依赖的package包/类
public MergedLogSourceIterator(MergedLogSource src, long starttime, long endtime, FilterOp filter) throws IllegalArgumentException, FilterException {
Vector<LogIterator> iters = new Vector<LogIterator>();
for (LogSource s : src.sources) {
if (s.overlapsRange(starttime, endtime)) {
iters.add(s.iterator(starttime, endtime, filter));
}
}
sources = new LogIterator[iters.size()];
sources = iters.toArray(sources);
nexts = new LogEntry[iters.size()];
for (int i = 0; i < sources.length; i++) {
if (sources[i].hasNext())
nexts[i] = sources[i].next();
}
this.filter = filter;
}
示例11: setParser
import java.util.Vector; //导入方法依赖的package包/类
public void setParser(Parser parser) {
super.setParser(parser);
// find all expressions in this Union
final Vector components = new Vector();
flatten(components);
final int size = components.size();
_components = (Expression[])components.toArray(new Expression[size]);
for (int i = 0; i < size; i++) {
_components[i].setParser(parser);
_components[i].setParent(this);
if (_components[i] instanceof Step) {
final Step step = (Step)_components[i];
final int axis = step.getAxis();
final int type = step.getNodeType();
// Put attribute iterators first
if ((axis == Axis.ATTRIBUTE) || (type == DTM.ATTRIBUTE_NODE)) {
_components[i] = _components[0];
_components[0] = step;
}
// Check if the union contains a reverse iterator
if (Axis.isReverse(axis)) _reverse = true;
}
}
// No need to reverse anything if another expression lies on top of this
if (getParent() instanceof Expression) _reverse = false;
}
示例12: getAllDevicesPath
import java.util.Vector; //导入方法依赖的package包/类
public String[] getAllDevicesPath() {
Vector<String> devices = new Vector<String>();
// Parse each driver
Iterator<Driver> itdriv;
try {
itdriv = getDrivers().iterator();
while (itdriv.hasNext()) {
Driver driver = itdriv.next();
Iterator<File> itdev = driver.getDevices().iterator();
while (itdev.hasNext()) {
String device = itdev.next().getAbsolutePath();
devices.add(device);
}
}
} catch (IOException e) {
e.printStackTrace();
}
return devices.toArray(new String[devices.size()]);
}
示例13: sortByName
import java.util.Vector; //导入方法依赖的package包/类
public void sortByName(final Row row, final boolean element) {
if (row == null) {
final Vector v = getChilds(null, element);
final Object o[] = v.toArray();
Arrays.sort(o, new RowNameComparator<Object>());
} else
row.sortByName(element);
}
示例14: getExtensions
import java.util.Vector; //导入方法依赖的package包/类
public String[] getExtensions() {
Vector v = new Vector();
String[] ss = {};
Elements exts = _root.getChildElements("ext");
for (int i = 0; i < exts.size(); i++)
v.add(exts.get(i).getValue());
return (String[]) v.toArray(ss);
}
示例15: SerialStruct
import java.util.Vector; //导入方法依赖的package包/类
/**
* Constructs a <code>SerialStruct</code> object from the
* given <code>SQLData</code> object, using the given type
* map to custom map it to a class in the Java programming
* language. The type map gives the SQL type and the class
* to which it is mapped. The <code>SQLData</code> object
* defines the class to which the SQL type will be mapped.
*
* @param in an instance of the <code>SQLData</code> class
* that defines the mapping of the SQL structured
* type to one or more objects in the Java programming language
* @param map a <code>java.util.Map</code> object in which
* each entry consists of 1) a <code>String</code> object
* giving the fully qualified name of a UDT and 2) the
* <code>Class</code> object for the <code>SQLData</code> implementation
* that defines how the UDT is to be mapped
* @throws SerialException if an error occurs
*/
public SerialStruct(SQLData in, Map<String,Class<?>> map)
throws SerialException
{
try {
//set the type name
SQLTypeName = in.getSQLTypeName();
Vector<Object> tmp = new Vector<>();
in.writeSQL(new SQLOutputImpl(tmp, map));
attribs = tmp.toArray();
} catch (SQLException e) {
throw new SerialException(e.getMessage());
}
}