1 25 package org.objectweb.easybeans.tests.common.helper; 26 27 import java.util.List ; 28 29 34 public final class ListHelper { 35 36 40 private ListHelper(){ 41 } 42 43 52 @SuppressWarnings ("unchecked") 53 public static <E> List <E> addValues(final List <E> list, final E[] values) throws InstantiationException , 54 IllegalAccessException { 55 56 if (list != null) { 57 List <E> lstNew = list.getClass().newInstance(); 59 60 lstNew.addAll(list); 62 63 if (values != null){ 65 for (E eObj : values) { 66 lstNew.add(eObj); 67 } 68 } 69 return lstNew; 70 } 71 return null; 72 } 73 74 82 @SuppressWarnings ("unchecked") 83 public static <E> List <E> convertListType(final List list) throws InstantiationException , 84 IllegalAccessException { 85 if (list != null) { 87 List <E> lstReturn = list.getClass().newInstance(); 89 if (list.size() > 0) { 91 for (Object obj : list) { 92 lstReturn.add((E) obj); 93 } 94 } 95 return lstReturn; 96 } 97 return null; 98 99 } 100 101 } 102 | Popular Tags |