All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.jweb.jstl.CollectionUtil Maven / Gradle / Ivy

Go to download

本项目主要弥补在使用mybatis3+springmvc+jquery easyui快速搭建web应用系统是遇到的框架不足. 主要工作包括: 1,扩展了ApplicationContextAware,通过单例注入spring容器,提供spring容器外的bean获取方法 2,扩展了apache shiro框架,统一了安全结构 3,扩展了mybatis3拦截器,在两个拦截器中自动完成分页注入,实现内存分页。 4,分页设计数据库方言 5,提供了一个easyuigrid的模型 6,提供了java泛型的jstl 7, xml工具包等一些小工具

There is a newer version: 1.1.10
Show newest version
package net.sourceforge.jweb.jstl;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

public class CollectionUtil {
	private CollectionUtil(){}
	public static boolean contains(Collection a, Object b){
		if(a==null) return false;
		return a.contains(b);
	}
	public static boolean isEmpty(Collection a){
		return a!=null&&a.isEmpty();
	}
	public static int size(Collection coll){
		return coll==null?0:coll.size();
	}
	public static Object[] toArray(Collection coll){
		return coll==null?new Object[]{}:coll.toArray();
	}
	public static boolean add(Collection coll, Object obj){
		return coll==null?false:coll.add(obj);
	}
	public static boolean remove(Collection coll, Object obj){
		return coll==null?false:coll.remove(obj);
	}
	public static boolean containsAll(Collection coll,Collection c){
		return coll==null?false:coll.containsAll(c);
	}
	public static  boolean addAll(Collection coll,Collection c){
		return coll==null?false:coll.addAll(c);
	}
	public static boolean removeAll(Collection coll,Collection c){
		return coll==null?false:coll.removeAll(c);
	}
	public static boolean retainAll(Collection coll,Collection c){
		return coll==null?false:coll.retainAll(c);
	}
	public static void clear(Collection coll){
		if(coll!=null) coll.clear();
	}
	public static boolean equals(Collection coll, Object obj){
		return coll==null?obj==null:coll.equals(obj);
	}
	public static int hashCode(Collection coll){
		return coll==null?-1:coll.hashCode();
	}
	//list
	public static boolean addAll(List coll, int index, Collection c){
		return coll==null?false:coll.addAll(index, c);
	}
	public static Object get(List coll, int index){
		return coll==null?null:coll.get(index);
	}
	public static Object set(List coll, int index, Object element){
		return coll==null?null:coll.set(index, element);
	}
	public static void add(List coll, int index, Object element){
		if(coll!=null) coll.add(index,element);
	}
	public static Object remove(List coll, int index){
		return coll==null?null:coll.remove(index);
	}
	public static int indexOf(List coll,Object o){
		return coll==null?-1:coll.indexOf(o);
	}
	public static int lastIndexOf(List coll,Object o){
		return coll==null?-1:coll.lastIndexOf(o);
	}
	public static List subList(List coll,int fromIndex, int toIndex){
		return coll==null?new ArrayList(1):coll.subList(fromIndex, toIndex);
	}
	
}