本文整理了Java中java.util.Vector.toArray()
方法的一些代码示例,展示了Vector.toArray()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vector.toArray()
方法的具体详情如下:
包路径:java.util.Vector
类名称:Vector
方法名:toArray
[英]Returns a new array containing all elements contained in this vector.
[中]返回包含此向量中所有元素的新数组。
代码示例来源:origin: jenkinsci/jenkins
public String[] getStatuses() {
synchronized (statuses) {
return statuses.toArray(new String[statuses.size()]);
}
}
代码示例来源:origin: libgdx/libgdx
ZipEntryRO[] getEntriesAt(String path) {
Vector<ZipEntryRO> zev = new Vector<ZipEntryRO>();
Collection<ZipEntryRO> values = mHashMap.values();
if (null == path)
path = "";
int length = path.length();
for (ZipEntryRO ze : values) {
if (ze.mFileName.startsWith(path)) {
if (-1 == ze.mFileName.indexOf('/', length)) {
zev.add(ze);
}
}
}
ZipEntryRO[] entries = new ZipEntryRO[zev.size()];
return zev.toArray(entries);
}
代码示例来源:origin: marytts/marytts
/**
* @param allInOneLine
* allInOneLine
* @return result.toArray(new String[0])
* @deprecated Unstable due to platform-specific behavior. Use {@link org.apache.commons.lang.StringUtils#split} or similar
* instead.
*/
@Deprecated
public static String[] toStringArray(String allInOneLine) {
if (allInOneLine != "") {
Vector<String> result = new Vector<String>();
StringTokenizer s = new StringTokenizer(allInOneLine, System.getProperty("line.separator"));
String line = null;
// Read until either end of file or an empty line
while (s.hasMoreTokens() && ((line = s.nextToken()) != null) && (!line.equals("")))
result.add(line);
return result.toArray(new String[0]);
} else
return null;
}
代码示例来源:origin: gocd/gocd
Vector noLinks = new Vector();
for (int i = 0; i < newfiles.length; i++) {
try {
newfiles = (String[]) (noLinks.toArray(new String[noLinks.size()]));
代码示例来源:origin: xalan/xalan
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;
}
代码示例来源:origin: libgdx/libgdx
ZipEntryRO[] getEntriesAt(String path) {
Vector<ZipEntryRO> zev = new Vector<ZipEntryRO>();
Collection<ZipEntryRO> values = mHashMap.values();
if (null == path)
path = "";
int length = path.length();
for (ZipEntryRO ze : values) {
if (ze.mFileName.startsWith(path)) {
if (-1 == ze.mFileName.indexOf('/', length)) {
zev.add(ze);
}
}
}
ZipEntryRO[] entries = new ZipEntryRO[zev.size()];
return zev.toArray(entries);
}
代码示例来源:origin: log4j/log4j
public
MBeanInfo getMBeanInfo() {
//cat.debug("getMBeanInfo called.");
MBeanAttributeInfo[] attribs = new MBeanAttributeInfo[vAttributes.size()];
vAttributes.toArray(attribs);
return new MBeanInfo(dClassName,
dDescription,
attribs,
dConstructors,
dOperations,
new MBeanNotificationInfo[0]);
}
代码示例来源:origin: eclipse/paho.mqtt.java
public MqttDeliveryToken[] getOutstandingDelTokens() {
final String methodName = "getOutstandingDelTokens";
synchronized(tokens) {
//@TRACE 311=>
log.fine(CLASS_NAME,methodName,"311");
Vector list = new Vector();
Enumeration enumeration = tokens.elements();
MqttToken token;
while(enumeration.hasMoreElements()) {
token = (MqttToken)enumeration.nextElement();
if (token != null
&& token instanceof MqttDeliveryToken
&& !token.internalTok.isNotified()) {
list.addElement(token);
}
}
MqttDeliveryToken[] result = new MqttDeliveryToken[list.size()];
return (MqttDeliveryToken[]) list.toArray(result);
}
}
代码示例来源:origin: marytts/marytts
/**
* @param allInOneLine
* allInOneLine
* @return result.toArray(new String[0])
* @deprecated Unstable due to platform-specific behavior. Use {@link org.apache.commons.lang.StringUtils#split} or similar
* instead.
*/
@Deprecated
public static String[] toStringArray(String allInOneLine) {
if (allInOneLine != "") {
Vector<String> result = new Vector<String>();
StringTokenizer s = new StringTokenizer(allInOneLine, System.getProperty("line.separator"));
String line = null;
// Read until either end of file or an empty line
while (s.hasMoreTokens() && ((line = s.nextToken()) != null) && (!line.equals("")))
result.add(line);
return result.toArray(new String[0]);
} else
return null;
}
代码示例来源:origin: stackoverflow.com
Vector<String> vector = new Vector<String>();
String[] strings = vector.toArray(new String[vector.size()]);
代码示例来源:origin: libgdx/libgdx
static String[] getAPKExpansionFiles(Context ctx, int mainVersion,
int patchVersion) {
String packageName = ctx.getPackageName();
Vector<String> ret = new Vector<String>();
if (Environment.getExternalStorageState().equals(
Environment.MEDIA_MOUNTED)) {
File main = new File(strMainPath);
if (main.isFile()) {
ret.add(strMainPath);
File main = new File(strPatchPath);
if (main.isFile()) {
ret.add(strPatchPath);
String[] retArray = new String[ret.size()];
ret.toArray(retArray);
return retArray;
代码示例来源:origin: log4j/log4j
public
MBeanInfo getMBeanInfo() {
cat.debug("getMBeanInfo called.");
MBeanAttributeInfo[] attribs = new MBeanAttributeInfo[dAttributes.size()];
dAttributes.toArray(attribs);
return new MBeanInfo(dClassName,
dDescription,
attribs,
dConstructors,
dOperations,
new MBeanNotificationInfo[0]);
}
代码示例来源:origin: apache/geode
if (pureMode || (env != null && env.size() > 0)) {
StringBuffer sb = new StringBuffer();
Vector cmdVec = new Vector();
cmdVec.add("cmd.exe");
cmdVec.add("/c");
sb.append("start /b \"\" ");
} else {
cmdVec.add("bash");
cmdVec.add("--norc");
cmdVec.add("-c");
cmdVec.add(sb.toString());
String[] cmdStrings = (String[]) cmdVec.toArray(new String[0]);
if (trace != null && trace.length() > 0) {
for (int i = 0; i < cmdStrings.length; i++) {
代码示例来源:origin: libgdx/libgdx
static String[] getAPKExpansionFiles(Context ctx, int mainVersion,
int patchVersion) {
String packageName = ctx.getPackageName();
Vector<String> ret = new Vector<String>();
if (Environment.getExternalStorageState().equals(
Environment.MEDIA_MOUNTED)) {
File main = new File(strMainPath);
if (main.isFile()) {
ret.add(strMainPath);
File main = new File(strPatchPath);
if (main.isFile()) {
ret.add(strPatchPath);
String[] retArray = new String[ret.size()];
ret.toArray(retArray);
return retArray;
代码示例来源:origin: log4j/log4j
public
MBeanInfo getMBeanInfo() {
cat.debug("getMBeanInfo called.");
MBeanAttributeInfo[] attribs = new MBeanAttributeInfo[dAttributes.size()];
dAttributes.toArray(attribs);
return new MBeanInfo(dClassName,
dDescription,
attribs,
dConstructors,
dOperations,
new MBeanNotificationInfo[0]);
}
代码示例来源:origin: marytts/marytts
Vector v = new Vector(16, 16);
Vector vf = new Vector(16, 16);
float aWeight = Float.parseFloat(fields[0]);
sumOfWeights += aWeight;
v.add(new Float(aWeight)); // Push the weight
vf.add(fields[1]); // Push the function
String[] wfun = (String[]) vf.toArray(new String[vf.size()]);
float[] fw = new float[v.size()];
for (int i = 0; i < fw.length; i++) {
Float aWeight = (Float) v.get(i);
代码示例来源:origin: log4j/log4j
public
MBeanInfo getMBeanInfo() {
//cat.debug("getMBeanInfo called.");
MBeanAttributeInfo[] attribs = new MBeanAttributeInfo[dAttributes.size()];
dAttributes.toArray(attribs);
MBeanInfo mb = new MBeanInfo(dClassName,
dDescription,
attribs,
dConstructors,
dOperations,
new MBeanNotificationInfo[0]);
//cat.debug("getMBeanInfo exit.");
return mb;
}
代码示例来源:origin: marytts/marytts
Vector v = new Vector(16, 16);
Vector vf = new Vector(16, 16);
float aWeight = Float.parseFloat(fields[0]);
sumOfWeights += aWeight;
v.add(new Float(aWeight)); // Push the weight
vf.add(fields[1]); // Push the function
String[] wfun = (String[]) vf.toArray(new String[vf.size()]);
float[] fw = new float[v.size()];
for (int i = 0; i < fw.length; i++) {
Float aWeight = (Float) v.get(i);
代码示例来源:origin: gocd/gocd
/**
* Get the list of patterns that should be excluded by default.
*
* @return An array of <code>String</code> based on the current
* contents of the <code>defaultExcludes</code>
* <code>Vector</code>.
*
* @since Ant 1.6
*/
public static String[] getDefaultExcludes() {
return (String[]) defaultExcludes.toArray(new String[defaultExcludes
.size()]);
}
代码示例来源:origin: KronicDeth/intellij-elixir
@DataPoints
public static CharSequence[] dataPoints() {
Vector<CharSequence> charSequences = new Vector<CharSequence>();
charSequences.add(bracedCharacterCode("123456"));
charSequences.add(bracedCharacterCode("789012"));
charSequences.add(bracedCharacterCode("ABCDEF"));
charSequences.add(bracedCharacterCode("abcdef"));
charSequences.add(bracedCharacterCode("0"));
return charSequences.toArray(new CharSequence[charSequences.size()]);
};
内容来源于网络,如有侵权,请联系作者删除!