Here you can find the source of joinRelativePath(List
Parameter | Description |
---|---|
components | a parameter |
public static String joinRelativePath(List<String> components)
//package com.java2s; //License from project: Open Source License import java.util.Arrays; import java.util.List; public class Main { /**//from ww w.ja v a 2 s .c o m * Construct a relative path from the given components * @param components * @return relative path */ public static String joinRelativePath(List<String> components) { StringBuilder builder = new StringBuilder(); for (String component : components) { if (builder.length() > 0) builder.append('/'); builder.append(component); } return builder.toString(); } /** * Vararg version of joinRelativePath * @param components * @return relative path */ public static String joinRelativePath(String... components) { return joinRelativePath(Arrays.asList(components)); } }