List of utility methods to do Stack to
String | stack2String(Stack stack) stack String Object[] strings = (Object[]) stack.toArray(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < strings.length; i++) sb.append(strings[i]); return sb.toString(); |
List | stackToList(Stack stack To List List<T> list = new ArrayList<>(); while (!stack.isEmpty()) list.add(stack.pop()); return list; |
Object[] | stackToTuple(Stack s) stack To Tuple if (s.empty()) { return emptyTuple; Object[] result = new Object[s.size()]; s.copyInto(result); return result; |