Revision 2640 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/ContainerUtils.java
ContainerUtils.java | ||
---|---|---|
248 | 248 |
|
249 | 249 |
public static final Comparator<String> EQUALS_IGNORECASE_COMPARATOR = (Comparator<String>) (String o1, String o2) -> StringUtils.compareIgnoreCase(o1, o2); |
250 | 250 |
|
251 |
public static boolean notContains(Collection collection, Object value, Comparator comparator) { |
|
252 |
if(collection==null) { |
|
253 |
return false; |
|
254 |
} |
|
255 |
if(comparator==null) { |
|
256 |
comparator=EQUALS_IGNORECASE_COMPARATOR; |
|
257 |
} |
|
258 |
for (Object item : collection) { |
|
259 |
if( comparator.compare(item, value)==0 ) { |
|
260 |
return true; |
|
261 |
} |
|
262 |
} |
|
263 |
return false; |
|
264 |
} |
|
265 |
|
|
251 | 266 |
public static boolean contains(Collection collection, Object value, Comparator comparator) { |
267 |
if(collection==null) { |
|
268 |
return false; |
|
269 |
} |
|
270 |
if(comparator==null) { |
|
271 |
comparator=EQUALS_IGNORECASE_COMPARATOR; |
|
272 |
} |
|
252 | 273 |
for (Object item : collection) { |
253 | 274 |
if( comparator.compare(item, value)==0 ) { |
254 | 275 |
return true; |
Also available in: Unified diff