本文整理了Java中java.util.Stack.toArray()
方法的一些代码示例,展示了Stack.toArray()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Stack.toArray()
方法的具体详情如下:
包路径:java.util.Stack
类名称:Stack
方法名:toArray
暂无
代码示例来源:origin: pentaho/pentaho-kettle
private static String[] credit_card_number( String[] prefixList, int length, int howMany ) {
Stack<String> result = new Stack<String>();
for ( int i = 0; i < howMany; i++ ) {
int randomArrayIndex = (int) Math.floor( Math.random() * prefixList.length );
String ccnumber = prefixList[randomArrayIndex];
result.push( completed_number( ccnumber, length ) );
}
return result.toArray( new String[result.size()] );
}
代码示例来源:origin: hankcs/HanLP
/**
* 获取唯一一条最短路径,当然最短路径可能不只一条
* @return
*/
public Integer[] getBestPath()
{
assert (vertexCount > 2);
Stack<Integer> stack = new Stack<Integer>();
int curNode = vertexCount - 1, curIndex = 0;
QueueElement element;
element = fromArray[curNode - 1][curIndex].GetFirst();
stack.push(curNode);
stack.push(element.from);
curNode = element.from;
while (curNode != 0)
{
element = fromArray[element.from - 1][element.index].GetFirst();
stack.push(element.from);
curNode = element.from;
}
return (Integer[]) stack.toArray();
}
代码示例来源:origin: apache/hive
private void getLocks(Stack<String> names, boolean verify,
boolean fetchData, List<HiveLock> locks, HiveConf conf) throws LockException {
lock.lock();
try {
if (hasLock()) {
getLocks(names.toArray(new String[names.size()]), verify, fetchData, locks, conf);
}
if (children != null) {
for (Map.Entry<String, Node> entry : children.entrySet()) {
names.push(entry.getKey());
entry.getValue().getLocks(names, verify, fetchData, locks, conf);
names.pop();
}
}
} finally {
lock.unlock();
}
}
代码示例来源:origin: apache/drill
private void getLocks(Stack<String> names, boolean verify,
boolean fetchData, List<HiveLock> locks, HiveConf conf) throws LockException {
lock.lock();
try {
if (hasLock()) {
getLocks(names.toArray(new String[names.size()]), verify, fetchData, locks, conf);
}
if (children != null) {
for (Map.Entry<String, Node> entry : children.entrySet()) {
names.push(entry.getKey());
entry.getValue().getLocks(names, verify, fetchData, locks, conf);
names.pop();
}
}
} finally {
lock.unlock();
}
}
代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-core-utilities
public <E> E[] toArray(E[] a) {
return stack.toArray(a);
}
});
代码示例来源:origin: org.apache.velocity/com.springsource.org.apache.velocity
/**
* get the current macro name stack
*
* @return Object[] with the macro name stack contents.
*/
public Object[] getMacroNameStack()
{
return macroNameStack.toArray();
}
代码示例来源:origin: org.apache.velocity/com.springsource.org.apache.velocity
/**
* get the current template name stack
*
* @return Object[] with the template name stack contents.
*/
public Object[] getTemplateNameStack()
{
return templateNameStack.toArray();
}
代码示例来源:origin: com.bbossgroups/bboss-velocity
/**
* get the current macro name stack
*
* @return Object[] with the macro name stack contents.
*/
public Object[] getMacroNameStack()
{
return macroNameStack.toArray();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.velocity
/**
* get the current macro name stack
*
* @return Object[] with the macro name stack contents.
*/
public Object[] getMacroNameStack()
{
return macroNameStack.toArray();
}
代码示例来源:origin: com.sun.xml.bind/jaxb-extra-osgi
/**
* takes a snap shot of traversal to this.errorSnapshot
* so that the user will know what references cause this problem.
*/
private void takeSnapshot( ReferenceExp lastExp ) {
errorSnapshot = new ReferenceExp[ traversalStack.size()+1 ];
traversalStack.toArray(errorSnapshot);
errorSnapshot[errorSnapshot.length-1] = lastExp;
}
}
代码示例来源:origin: msv/msv
/**
* takes a snap shot of traversal to this.errorSnapshot
* so that the user will know what references cause this problem.
*/
private void takeSnapshot( ReferenceExp lastExp ) {
errorSnapshot = new ReferenceExp[ traversalStack.size()+1 ];
traversalStack.toArray(errorSnapshot);
errorSnapshot[errorSnapshot.length-1] = lastExp;
}
}
代码示例来源:origin: org.apache.velocity/velocity-engine-core
/**
* get the current macro name stack
*
* @return String[] with the macro name stack contents.
*/
public String[] getMacroNameStack()
{
return macroNameStack.toArray(new String[macroNameStack.size()]);
}
代码示例来源:origin: beanshell/beanshell
/**
zero based.
*/
public NameSpace get(int depth) {
int size = stack.size();
if ( depth >= size )
return NameSpace.JAVACODE;
return stack.toArray(new NameSpace[size])[size-1-depth];
}
代码示例来源:origin: org.openmobster.core/mobileObject
private String getUri()
{
StringBuilder buffer = new StringBuilder();
String[] uriPieces = this.uriStack.toArray(new String[0]);
for(String piece: uriPieces)
{
buffer.append("/"+piece);
}
return buffer.toString();
}
//-----------------------------------------------------------------------------------------------------
代码示例来源:origin: org.jruby/jruby-complete
private void emitEnsureBlocks(IRLoop loop) {
int n = activeEnsureBlockStack.size();
EnsureBlockInfo[] ebArray = activeEnsureBlockStack.toArray(new EnsureBlockInfo[n]);
for (int i = n-1; i >= 0; i--) {
EnsureBlockInfo ebi = ebArray[i];
// For "break" and "next" instructions, we only want to run
// ensure blocks from the loops they are present in.
if (loop != null && ebi.innermostLoop != loop) break;
// Clone into host scope
ebi.cloneIntoHostScope(this);
}
}
代码示例来源:origin: org.jruby/jruby-core
private void emitEnsureBlocks(IRLoop loop) {
int n = activeEnsureBlockStack.size();
EnsureBlockInfo[] ebArray = activeEnsureBlockStack.toArray(new EnsureBlockInfo[n]);
for (int i = n-1; i >= 0; i--) {
EnsureBlockInfo ebi = ebArray[i];
// For "break" and "next" instructions, we only want to run
// ensure blocks from the loops they are present in.
if (loop != null && ebi.innermostLoop != loop) break;
// Clone into host scope
ebi.cloneIntoHostScope(this);
}
}
代码示例来源:origin: net.sourceforge.retroweaver/retroweaver-rt
private void endFormal() {
Type bounds[] = stack.toArray(new Type[stack.size()]);
stack.removeAllElements();
formalTypeParameters.getLast().setBounds(bounds);
}
代码示例来源:origin: org.astrogrid/astrogrid-adqlparser-base
public void setError( String message ) {
Error error = new Error() ;
error.setMessage( message ) ;
Part[] position = new Part[ stack.size() ] ;
position = (Part[])stack.toArray( position ) ;
for( int i=0; i<position.length; i++ ) {
position[i] = newPart( position[i] ) ;
}
error.setPosition( position ) ;
errors.add( error ) ;
}
代码示例来源:origin: org.astrogrid/astrogrid-adqlstox
public void setError( String message ) {
Error error = new Error() ;
error.setMessage( message ) ;
Part[] position = new Part[ stack.size() ] ;
position = (Part[])stack.toArray( position ) ;
for( int i=0; i<position.length; i++ ) {
position[i] = newPart( position[i] ) ;
}
error.setPosition( position ) ;
errors.add( error ) ;
}
代码示例来源:origin: org.eclipse/org.eclipse.jst.pagedesigner
protected void setClipboard(Stack result) {
Node[] nodes = (Node[]) result.toArray(new Node[result.size()]);
StringBuffer sb = new StringBuffer();
for (int i = 0, size = nodes.length; i < size; i++) {
DOMUtil.nodeToString(nodes[i], sb);
}
getClipboard().setContents(
new Object[] { result, sb.toString() },
new Transfer[] { TemplateTransfer.getInstance(),
TextTransfer.getInstance() });
}
内容来源于网络,如有侵权,请联系作者删除!