Java Stack Create listToStack(List list)

Here you can find the source of listToStack(List list)

Description

list To Stack

License

Open Source License

Declaration

public static <T> Stack<T> listToStack(List<T> list) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.List;
import java.util.Stack;

public class Main {
    public static <T> Stack<T> listToStack(List<T> list) {
        Stack<T> stack = new Stack<>();
        for (int i = list.size() - 1; i >= 0; i--)
            stack.push(list.get(i));//from  w  w  w.jav a 2s.com
        return stack;
    }
}

Related

  1. checkStack(Object object, Class type)
  2. getCharStack()
  3. toStack(int[] input)