Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; import java.util.Stack; public class Main { public static <T> List<T> stackToList(Stack<T> stack) { List<T> list = new ArrayList<>(); while (!stack.isEmpty()) list.add(stack.pop()); return list; } }