Java tutorial
//package com.java2s; import java.util.Iterator; import java.util.LinkedList; public class Main { public static String toString(Iterable<Object> pathItrb) { LinkedList<Object> list = new LinkedList<Object>(); Iterator itr = pathItrb.iterator(); while (itr.hasNext()) { list.addFirst(itr.next()); } // StringBuilder sb = new StringBuilder(); boolean isFirst = true; for (Object obj : list) { if (isFirst) { isFirst = false; } else { sb.append("/"); // NOI18N } sb.append(obj.toString()); } // return sb.toString(); } }