`
rekoe.net
  • 浏览: 8067 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

判断集合中的某个元素

阅读更多
public static boolean in_array(Object[] source, Object ext){
		return in_array(source, ext, false);
	}
	public static boolean in_array(Object[] source, Object ext, boolean strict){
		if(source==null||ext==null){
			return false;
		}
		for(Object s : source){
			if(s.toString().equals(ext.toString())){
				if(strict){
					if((s.getClass().getName().equals(ext.getClass().getName()))){
						return true;
					}
				}else{
					return true;
				}
			}
		}
		return false;
	}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics