-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTextUtilFunctions.java
More file actions
55 lines (41 loc) · 1.1 KB
/
Copy pathTextUtilFunctions.java
File metadata and controls
55 lines (41 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package com.research.course.debate.util;
import java.util.HashSet;
import java.util.Set;
public class TextUtilFunctions {
public static boolean checkAlphaNumeric(String token)
{
// TODO Auto-generated method stub
//anything below three letters - no good
if (token.length() < 3)
{
return false ;
}
char[] chars = token.toCharArray();
for ( char c : chars )
{
if ( 'a' <= c && c<= 'z')
{
return true ;
}
}
return false;
}
public static Set<String> common( Set<String> first, Set<String> second)
{
Set<String> intersection = new HashSet<String>(first);
intersection.retainAll(second);
return intersection ;
}
public static Set<String> uncommon( Set<String> first, Set<String> second)
{
Set<String> notcommon = new HashSet<String>();
Set<String> firstCopy = new HashSet<String>(first);
Set<String> secondCopy = new HashSet<String>(second);
firstCopy.removeAll(secondCopy);
notcommon.addAll(firstCopy);
firstCopy = new HashSet<String>(first);
secondCopy.removeAll(firstCopy);
notcommon.addAll(secondCopy);
return notcommon ;
}
}