Return to Snippet

Revision: 41444
at February 18, 2011 03:59 by kingd9


Updated Code
long[] returnIds;
if (!CollectionUtils.isEmpty(ids)) {
   //non empty collection
   int count = 0;
   resourceIds = new long[this.selectedResources.size()];
   for (Long id : ids) {
	if(null==id){
	//convert nulls to 0s
 	   id=0L;
	}
	   returnIds[count++] = id;
   }
} else {
   returnIds = new long[0];
}

Revision: 41443
at February 18, 2011 03:14 by kingd9


Initial Code
long[] ids;
if (!CollectionUtils.isEmpty(SetIds)) {
	int count = 0;
	ids= new long[SetIds.size()];
	for (Long SetId: SetIds) {
		ids[count++] = SetId;
	}
} else {
	ids= new long[0];
}

Initial URL


Initial Description


Initial Title
Convert Collection of Primitive Wrapper Objects  to Primitives

Initial Tags


Initial Language
Java