Here you can find the source of reversePath(List
Parameter | Description |
---|---|
pathParts | path to reverse |
public static Stack<String> reversePath(List<String> pathParts)
//package com.java2s; //License from project: LGPL import java.util.*; public class Main { /**/*from w w w . ja va 2s .c o m*/ * Reverse path and return as a stack. First path element is on top of the * stack. * * @param pathParts path to reverse * @return reversed path or an empty stack if no path parts are given. Never * return null. */ public static Stack<String> reversePath(List<String> pathParts) { Stack<String> pathStack = new Stack<String>(); if (pathParts != null) { // Needs first extra argument at top of the stack for (int i = pathParts.size() - 1; i >= 0; i--) { pathStack.push(pathParts.get(i)); } } return pathStack; } }