Java examples for Collection Framework:Set
search For Common String between two set
//package com.java2s; 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;//from ww w .ja va 2 s. c om break; } return matched; } }