在两个集合之间搜索公共字符串
//package com.nowjava; /*n o w j a v a . c o m 提 供*/ import java.util.Set; public class Main { public static String searchForCommonString(Set<String> s1, Set<String> s2) { String matched = ""; for (String s1Word : s1) if (s2.contains(s1Word)) { matched = s1Word; break; } return matched; } }/*N o w J a v a . c o m - 时 代 Java 提 供*/