Java tutorial
//package com.java2s; import java.util.Iterator; import java.util.Set; public class Main { /** * patterns: ["/util//note"] * @param Set<String> patterns * @return /util/note */ public static String first(Set<String> patterns) { String str = ""; if (patterns != null && patterns.size() > 0) { Iterator<String> iterator = patterns.iterator(); while (iterator.hasNext()) { str = (String) iterator.next(); str = str.replaceAll("//", "/"); break; } } return str; } }