public static void writeIntegerCollection(@Nonnull NBTTagCompound data,@Nonnull Collection<Integer> coll){
  data.setInteger("size",coll.size());
  final int[] ary=new int[coll.size()];
  int i=0;
  for (  Integer num : coll) {
    ary[i]=num;
    i++;
  }
  data.setTag("data",new NBTTagIntArray(ary));
}

public static void writeIntegerCollection ( @ Nonnull NBTTagCompound data , @ Nonnull Collection < Integer > coll ) { data . setInteger ( "size" , coll . size ( ) ) ; final int [ ] ary = new int [ coll . size ( ) ] ; int i = 0 ; for ( Integer num : coll ) { ary [ i ] = num ; i ++ ; } data . setTag ( "data" , new NBTTagIntArray ( ary ) ) ; }
writes the given collection to the nbttagcompound as an intarray
