/**
* 1.上边界通配符,Number与Number子类
*/
List extends Number> numberListFour = new ArrayList();
numberListFour = new ArrayList();
numberListFour = new ArrayList();
numberListFour = new ArrayList();
/**
* 2.下边界通配符,Integer与Integer父类
*/
List super Integer> integerList = new ArrayList();
integerList = new ArrayList();
integerList = new ArrayList
/**
* 获取集合长度
*/
public static int size(Collection list){
return list.size();
}
/**
* 获取集合长度-2
*/
public static int sizeTwo(Collection> list){
return list.size();
}
/**
* 获取任意Set两个集合交集数量
*/
public static int beMixedSum(Set s1,Set s2){
int i = 0;
for (T t : s1) {
if (s2.contains(t)) {
i++;
}
}
return i;
}
/**
* 获取任意两个Set集合交集数量-2
*/
public static int beMixedSumTwo(Set> s1,Set> s2){
int i = 0;
for (Object o : s1) {
if (s2.contains(o)) {
i++;
}
}
return i;
}
/**
* 集合工具类
*/
public class CollectionUtils{
/**
* 复制集合-泛型
*/
public List listCopy(Collection collection){
List newCollection = new ArrayList<>();
for (T t : collection) {
newCollection.add(t);
}
return newCollection;
}
}
public static void main(String[] agrs){
CollectionUtils collectionUtils = new CollectionUtils<>();
List list = new ArrayList<>();
//list.add....
List listTwo = new ArrayList<>();
//listTwo.add....
List listThree = new ArrayList<>();
//listThree.add....
List list1 = collectionUtils.listCopy(list);
list1 = collectionUtils.listCopy(listTwo);//err 编译异常
list1 = collectionUtils.listCopy(listThree);//err 编译异常
}
/**
* 集合工具
*/
public class CollectionUtils{
/**
* 复制集合-泛型
*/
public List listCopy(Collection collection){
List newCollection = new ArrayList<>();
for (T t : collection) {
newCollection.add(t);
}
return newCollection;
}
/**
* 复制集合-上边界通配符
*/
public List listCopyTwo(Collection extends T> collection){
List newCollection = new ArrayList<>();
for (T t : collection) {
newCollection.add(t);
}
return newCollection;
}
}
public static void main(String[] agrs){
CollectionUtils collectionUtils = new CollectionUtils<>();
List list = new ArrayList<>();
//list.add....
List listTwo = new ArrayList<>();
//listTwo.add....
List listThree = new ArrayList<>();
//listThree.add....
List list1 = collectionUtils.listCopyTwo(list);
list1 = collectionUtils.listCopyTwo(listTwo);
list1 = collectionUtils.listCopyTwo(listThree);
}
/**
* 儿子
*/
public class Son extends Father{}
/**
* 父亲
*/
public class Father extends Grandpa{}
/**
* 爷爷
*/
public class Grandpa {}
/**
* 集合工具
*/
public class CollectionUtils{
/**
* 复制集合-泛型
* target目标 src来源
*/
public void copy(List target,List src){
if (src.size() > target.size()){
for (int i = 0; i < src.size(); i++) {
target.set(i,src.get(i));
}
}
}
}
public static void main(String[] agrs){
CollectionUtils collectionUtils = new CollectionUtils<>();
List fatherTargets = new ArrayList<>();
List fatherSources = new ArrayList<>();
//fatherSources.add...
collectionUtils.copy(fatherTargets,fatherSources);
//子类复制到父类
List sonSources = new ArrayList<>();
//sonSources.add...
collectionUtils.copy(fatherTargets,sonSources);//err 编译异常
}
/**
* 集合工具
*/
public class CollectionUtils{
/**
* 复制集合-泛型
* target目标 src来源
*/
public void copy(List target,List extends T> src){
if (src.size() > target.size()){
for (int i = 0; i < src.size(); i++) {
target.set(i,src.get(i));
}
}
}
}
public static void main(String[] agrs){
CollectionUtils collectionUtils = new CollectionUtils<>();
List fatherTargets = new ArrayList<>();
List fatherSources = new ArrayList<>();
//fatherSources.add...
collectionUtils.copy(fatherTargets,fatherSources);
//子类复制到父类
List sonSources = new ArrayList<>();
//sonSources.add...
collectionUtils.copy(fatherTargets,sonSources);
//把子类复制到父类的父类
List grandpaTargets = new ArrayList<>();
collectionUtils.copy(grandpaTargets,sonSources);//err 编译异常
}
/**
* 集合工具
*/
public class CollectionUtils{
/**
* 复制集合-泛型
* target目标 src来源
*/
public void copy(List super T> target,List extends T> src){
if (src.size() > target.size()){
for (int i = 0; i < src.size(); i++) {
target.set(i,src.get(i));
}
}
}
}
public static void main(String[] agrs){
CollectionUtils collectionUtils = new CollectionUtils<>();
List fatherTargets = new ArrayList<>();
List fatherSources = new ArrayList<>();
//fatherSources.add...
collectionUtils.copy(fatherTargets,fatherSources);
//子类复制到父类
List sonSources = new ArrayList<>();
//sonSources.add...
collectionUtils.copy(fatherTargets,sonSources);
//把子类复制到父类的父类
List grandpaTargets = new ArrayList<>();
collectionUtils.copy(grandpaTargets,sonSources);
}
public class Person implements Comparable {
private int age;
public Person(int age) {
this.age = age;
}
public int getAge() {
return age;
}
@Override
public int compareTo(Person o) {
// 0代表相等 1代表大于 <0代表小于
return this.age - o.age;
}
}
/**
* 集合工具
*/
public class CollectionUtils{
/**
* 获取集合最大值
*/
public static > E max(List list){
E result = null;
for (E e : list) {
if (result == null || e.compareTo(result) > 0){
result = e;
}
}
return result;
}
}
public static void main(String[] agrs){
List personList = new ArrayList<>();
personList.add(new Person(12));
personList.add(new Person(19));
personList.add(new Person(20));
personList.add(new Person(5));
personList.add(new Person(18));
//返回年龄最大的Person元素
Person max = CollectionUtils.max(personList);
}
转:http://stackoverflow.com/questions/18145774/eclipse-an-error-occurred-while-filtering-resources
maven报错:
maven An error occurred while filtering resources
Maven -> Update Proje
在SVN服务控制台打开资源库“SVN无法读取current” ---摘自网络 写道 SVN无法读取current修复方法 Can't read file : End of file found
文件:repository/db/txn_current、repository/db/current
其中current记录当前最新版本号,txn_current记录版本库中版本