Java Stack to stackToTuple(Stack s)

Here you can find the source of stackToTuple(Stack s)

Description

stack To Tuple

License

Creative Commons License

Declaration

public static Object[] stackToTuple(Stack s) 

Method Source Code


//package com.java2s;
//License from project: Creative Commons License 

import java.util.Stack;

public class Main {
    /** new Object[0]. Defined as property for caching. */
    public static final Object emptyTuple[] = new Object[0];

    public static Object[] stackToTuple(Stack s) {
        if (s.empty()) {
            return emptyTuple;
        }/*from w  w  w  .j  a va2  s  . c om*/
        Object[] result = new Object[s.size()];
        s.copyInto(result);
        return result;
    }
}

Related

  1. stack2String(Stack stack)
  2. stackToList(Stack stack)